Skip to content

Commit

Permalink
Expose (almost) all of Bluebird's static methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed May 2, 2016
1 parent 5f72bcc commit 0c55a97
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/makePromise.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ function extractPromisesFromObject(obj) {
};
});

['resolve', 'reject'].forEach(function (staticMethodName) {
makePromise[staticMethodName] = Promise[staticMethodName];
// Expose all of Bluebird's static methods, except the ones related to long stack traces,
// unhandled rejections and the scheduler, which we need to manage ourselves:
Object.keys(Promise).forEach(function (staticMethodName) {
if (!/^_|^on|^setScheduler|ongStackTraces/.test(staticMethodName) && typeof makePromise[staticMethodName] === 'undefined') {
makePromise[staticMethodName] = Promise[staticMethodName];
}
});

module.exports = makePromise;

0 comments on commit 0c55a97

Please sign in to comment.