JSFiddle - React, Tailwind, and code Playground

JavaScript

Obj.prototype.checkDuration = function(arg) {
		var next = this.test; 
    
    arg.getDuration(function(err, days) {
        if (err) throw new Error("Error " + err);
        if (days == 0) next();
    });
}

Obj.prototype.test = function() {
    console.log("Done!");
}