Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Promise = require('bluebird');
- var inherits = require('inherits');
- var extend = require('xtend/mutable');
- function FantasyPromise() {
- return new (Promise.bind.apply(Promise, [this].concat([].slice.call(arguments))));
- }
- inherits(FantasyPromise, Promise);
- extend(FantasyPromis, Promise);
- FantasyPromise.prototype.chain = function(fn) {
- var that = this;
- return new FantasyPromise(function(resolve, reject) {
- that.then(function(v) {
- return fn(v).then(resolve);
- }).catch(reject);
- });
- };
- FantasyPromise.of = Promise.resolve;
- module.exports = FantasyPromise;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement