p-defer/index.js

15 lines
227 B
JavaScript

'use strict';
const pDefer = () => {
const deferred = {};
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
};
module.exports = pDefer;