promise-callbacks
Advanced tools
Comparing version
## Release History | ||
* 3.3.0 Add callAsync function | ||
* 3.2.2 Actually use explicit exports per #16. | ||
@@ -4,0 +6,0 @@ * 3.2.1 Use explicit exports per #16. |
{ | ||
"name": "promise-callbacks", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "Utilities to help convert a callback-using codebase to promises.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -56,5 +56,15 @@ # promise-callbacks | ||
What happened there is that `promise.deferred()` took the result of `respondWithDelay`, as a | ||
What happened there is that `promise.defer()` took the result of `respondWithDelay`, as a | ||
callback, and `resolved`/`rejected` the associated `Promise`. | ||
It's also possible to achieve the above more succinctly using the `callAsync` function, as follows: | ||
```js | ||
const { callAsync } = require('promise-callbacks'); | ||
async function foo() { | ||
console.log(await callAsync(respondWithDelay)); | ||
} | ||
``` | ||
### Variadic arguments | ||
@@ -198,4 +208,4 @@ | ||
// => Hello, world! | ||
defer.promise.then((message) => console.log(message)); | ||
defer.resolve('Hello, world!'); | ||
def.promise.then((message) => console.log(message)); | ||
def.resolve('Hello, world!'); | ||
``` | ||
@@ -202,0 +212,0 @@ |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const static_ = require('./static'); | ||
const callAsync = require('./callAsync'); | ||
const deferred = require('./deferred'); | ||
@@ -25,2 +26,3 @@ const defer = require('./defer'); | ||
exports.unpatchPromise = unpatchPromise; | ||
exports.callAsync = callAsync; | ||
exports.deferred = deferred; | ||
@@ -27,0 +29,0 @@ exports.defer = defer; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
63277
55.04%46
27.78%917
2.57%241
4.33%1
Infinity%