promise-callbacks
Advanced tools
Comparing version 2.1.2 to 2.1.3
## Release History | ||
* 2.1.3 Fix delay, static exports, accept resolve value for async primitives | ||
* 2.1.2 Fix for Node < 7 | ||
* 2.0.0 Replace sync with deferred, add promisify, fix asCallback | ||
* 1.0.0 Initial release |
{ | ||
"name": "promise-callbacks", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Utilities to help convert a callback-using codebase to promises.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -14,4 +14,6 @@ const { asCallback, patchPromise, unpatchPromise } = require('./asCallback'); | ||
promisifyAll: promisify.all, | ||
withTimeout: static.withTimeout, | ||
delay: static.delay | ||
withTimeout: static.statics.withTimeout, | ||
delay: static.statics.delay, | ||
nextTick: static.statics.nextTick, | ||
immediate: static.statics.immediate | ||
}; |
@@ -32,4 +32,4 @@ const hasOwn = Object.prototype.hasOwnProperty; | ||
// Instantiate the error here to capture a more useful stack trace. | ||
const error = (message instanceof Error) ? message : new Error(message); | ||
timeout = setTimeout(() => reject(error), delay); | ||
const error = message instanceof Error ? message : new Error(message); | ||
timeout = setTimeout(reject, delay, error); | ||
}); | ||
@@ -45,12 +45,12 @@ return Promise.race([promise, timeoutPromise]).then((value) => { | ||
function delay(time, ...args) { | ||
return new Promise((resolve) => setTimeout(resolve, delay, ...args)); | ||
function delay(time, value) { | ||
return new Promise((resolve) => setTimeout(resolve, time, value)); | ||
} | ||
function nextTick(...args) { | ||
return new Promise((resolve) => process.nextTick(resolve, ...args)); | ||
function nextTick(value) { | ||
return new Promise((resolve) => process.nextTick(resolve, value)); | ||
} | ||
function immediate(...args) { | ||
return new Promise((resolve) => setImmediate(resolve, ...args)); | ||
function immediate(value) { | ||
return new Promise((resolve) => setImmediate(resolve, value)); | ||
} | ||
@@ -60,3 +60,8 @@ | ||
patchPromiseStatic, | ||
unpatchPromiseStatic | ||
unpatchPromiseStatic, | ||
statics: {} | ||
}; | ||
for (let fn of staticProperties) { | ||
module.exports.statics[fn.name] = fn; | ||
} |
66328
590