promise-callbacks
Advanced tools
+1
-0
| ## Release History | ||
| * 2.1.2 Fix for Node < 7 | ||
| * 2.0.0 Replace sync with deferred, add promisify, fix asCallback | ||
| * 1.0.0 Initial release |
+4
-1
| { | ||
| "name": "promise-callbacks", | ||
| "version": "2.1.1", | ||
| "version": "2.1.2", | ||
| "description": "Utilities to help convert a callback-using codebase to promises.", | ||
@@ -35,3 +35,6 @@ "engines": { | ||
| "jasmine-promises": "github:mixmaxhq/jasmine-promises#working_in_node" | ||
| }, | ||
| "dependencies": { | ||
| "object.getownpropertydescriptors": "2.0.3" | ||
| } | ||
| } |
+19
-0
@@ -111,2 +111,21 @@ # promise-callbacks | ||
| ### Variadic callbacks | ||
| Much like `deferred`, you can receive multiple callback arguments by passing the `variadic` option to promisify. This also works with `promisify.methods` and `promisify.all`. | ||
| ```js | ||
| const { promisify } = require('promise-callbacks'); | ||
| function respondWithDelay(done) { | ||
| setTimeout(() => done(null, 3, 2, 1, 4), 2000); | ||
| } | ||
| const respondWithDelayPromised = promisify(respondWithDelay, {variadic: true}); | ||
| async function foo() { | ||
| console.log(await respondWithDelayPromised()); | ||
| // => [3, 2, 1, 4] | ||
| } | ||
| ``` | ||
| ## For an object | ||
@@ -113,0 +132,0 @@ |
+2
-1
@@ -27,2 +27,3 @@ /*************************************************************************************************** | ||
| const callbackBuilder = require('./callbackBuilder'); | ||
| const getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); | ||
@@ -72,3 +73,3 @@ /** | ||
| }); | ||
| return Object.defineProperties(fn, Object.getOwnPropertyDescriptors(orig)); | ||
| return Object.defineProperties(fn, getOwnPropertyDescriptors(orig)); | ||
| } | ||
@@ -75,0 +76,0 @@ |
+69
-19
@@ -85,3 +85,3 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
| brace-expansion@^1.0.0, brace-expansion@^1.1.7: | ||
| brace-expansion@^1.1.7: | ||
| version "1.1.7" | ||
@@ -185,2 +185,9 @@ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" | ||
| define-properties@^1.1.2: | ||
| version "1.1.2" | ||
| resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" | ||
| dependencies: | ||
| foreach "^2.0.5" | ||
| object-keys "^1.0.8" | ||
| del@^2.0.2: | ||
@@ -221,2 +228,19 @@ version "2.2.2" | ||
| es-abstract@^1.5.1: | ||
| version "1.7.0" | ||
| resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c" | ||
| dependencies: | ||
| es-to-primitive "^1.1.1" | ||
| function-bind "^1.1.0" | ||
| is-callable "^1.1.3" | ||
| is-regex "^1.0.3" | ||
| es-to-primitive@^1.1.1: | ||
| version "1.1.1" | ||
| resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" | ||
| dependencies: | ||
| is-callable "^1.1.1" | ||
| is-date-object "^1.0.1" | ||
| is-symbol "^1.0.1" | ||
| escape-html@~1.0.3: | ||
@@ -401,2 +425,6 @@ version "1.0.3" | ||
| foreach@^2.0.5: | ||
| version "2.0.5" | ||
| resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" | ||
| forwarded@~0.1.0: | ||
@@ -414,2 +442,6 @@ version "0.1.0" | ||
| function-bind@^1.0.2, function-bind@^1.1.0: | ||
| version "1.1.0" | ||
| resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" | ||
| generate-function@^2.0.0: | ||
@@ -425,3 +457,3 @@ version "2.0.0" | ||
| glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: | ||
| glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.2: | ||
| version "7.1.2" | ||
@@ -437,13 +469,2 @@ resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" | ||
| glob@^7.0.6: | ||
| version "7.1.1" | ||
| resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" | ||
| dependencies: | ||
| fs.realpath "^1.0.0" | ||
| inflight "^1.0.4" | ||
| inherits "2" | ||
| minimatch "^3.0.2" | ||
| once "^1.3.0" | ||
| path-is-absolute "^1.0.0" | ||
| globals@^9.17.0: | ||
@@ -474,2 +495,8 @@ version "9.18.0" | ||
| has@^1.0.1: | ||
| version "1.0.1" | ||
| resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" | ||
| dependencies: | ||
| function-bind "^1.0.2" | ||
| http-errors@~1.6.1: | ||
@@ -530,2 +557,10 @@ version "1.6.1" | ||
| is-callable@^1.1.1, is-callable@^1.1.3: | ||
| version "1.1.3" | ||
| resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" | ||
| is-date-object@^1.0.1: | ||
| version "1.0.1" | ||
| resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" | ||
| is-fullwidth-code-point@^2.0.0: | ||
@@ -568,2 +603,8 @@ version "2.0.0" | ||
| is-regex@^1.0.3: | ||
| version "1.0.4" | ||
| resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" | ||
| dependencies: | ||
| has "^1.0.1" | ||
| is-resolvable@^1.0.0: | ||
@@ -575,2 +616,6 @@ version "1.0.0" | ||
| is-symbol@^1.0.1: | ||
| version "1.0.1" | ||
| resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" | ||
| isarray@^1.0.0, isarray@~1.0.0: | ||
@@ -666,8 +711,2 @@ version "1.0.0" | ||
| minimatch@^3.0.2: | ||
| version "3.0.3" | ||
| resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" | ||
| dependencies: | ||
| brace-expansion "^1.0.0" | ||
| minimatch@^3.0.4: | ||
@@ -717,2 +756,13 @@ version "3.0.4" | ||
| object-keys@^1.0.8: | ||
| version "1.0.11" | ||
| resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" | ||
| object.getownpropertydescriptors@2.0.3: | ||
| version "2.0.3" | ||
| resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" | ||
| dependencies: | ||
| define-properties "^1.1.2" | ||
| es-abstract "^1.5.1" | ||
| on-finished@~2.3.0: | ||
@@ -719,0 +769,0 @@ version "2.3.0" |
66087
4.12%584
0.17%213
9.79%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added