Show More
Commit Description:
force log out when password change
Commit Description:
force log out when password change
References:
File last commit:
Show/Diff file:
Action:
node_modules/ext/thenable_/finally.js
| 24 lines
| 673 B
| application/javascript
| JavascriptLexer
|
r789 | "use strict"; | |||
var ensurePlainFunction = require("type/plain-function/ensure") | ||||
, isThenable = require("type/thenable/is") | ||||
, ensureThenable = require("type/thenable/ensure"); | ||||
var resolveCallback = function (callback, next) { | ||||
var callbackResult = callback(); | ||||
if (!isThenable(callbackResult)) return next(); | ||||
return callbackResult.then(next); | ||||
}; | ||||
module.exports = function (callback) { | ||||
ensureThenable(this); | ||||
ensurePlainFunction(callback); | ||||
return this.then( | ||||
function (result) { | ||||
return resolveCallback(callback, function () { return result; }); | ||||
}, | ||||
function (error) { | ||||
return resolveCallback(callback, function () { throw error; }); | ||||
} | ||||
); | ||||
}; | ||||