mirror of
https://github.com/mwilliamson/mammoth.js.git
synced 2024-12-08 15:14:29 +00:00
26 lines
760 B
JavaScript
26 lines
760 B
JavaScript
var _ = require("underscore");
|
|
var bluebird = require("bluebird/js/main/promise")();
|
|
|
|
exports.defer = bluebird.defer;
|
|
exports.when = bluebird.resolve;
|
|
exports.resolve = bluebird.resolve;
|
|
exports.all = bluebird.all;
|
|
exports.props = bluebird.props;
|
|
exports.reject = bluebird.reject;
|
|
exports.promisify = bluebird.promisify;
|
|
|
|
exports.nfcall = function(func) {
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
var promisedFunc = bluebird.promisify(func);
|
|
return promisedFunc.apply(null, args);
|
|
};
|
|
|
|
bluebird.prototype.fail = bluebird.prototype.caught;
|
|
|
|
bluebird.prototype.also = function(func) {
|
|
return this.then(function(value) {
|
|
var returnValue = _.extend({}, value, func(value));
|
|
return bluebird.props(returnValue);
|
|
});
|
|
};
|