Comparing version
19
index.js
@@ -1,8 +0,17 @@ | ||
var ninvoke = require('./lib/ninvoke'); | ||
var nfcall = require('./lib/nfcall'); | ||
var ninvoke = require('./ninvoke'); | ||
var npost = require('./npost'); | ||
var nfcall = require('./nfcall'); | ||
var nfapply = require('./nfapply'); | ||
var nfbind = require('./nfbind'); | ||
var nbind = require('./nbind'); | ||
module.exports = { | ||
nsend : ninvoke, | ||
ninvoke : ninvoke, | ||
nfcall : nfcall | ||
nsend : ninvoke, | ||
ninvoke : ninvoke, | ||
npost : npost, | ||
nfcall : nfcall, | ||
nfapply : nfapply, | ||
nfbind : nfbind, | ||
denodeify : nfbind, | ||
nbind : nbind | ||
}; |
@@ -0,1 +1,2 @@ | ||
var resolver = require('./resolver'); | ||
@@ -5,15 +6,5 @@ module.exports = function invoke(obj, fn) { | ||
return new Promise(function (resolve, reject) { | ||
args.push(function (err) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve.apply(undefined, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
try { | ||
obj[fn].apply(obj, args); | ||
} catch (err) { | ||
reject(err); | ||
} | ||
args.push(resolver(obj, resolve, reject)); | ||
obj[fn].apply(obj, args); | ||
}); | ||
}; |
{ | ||
"name": "mod-cons", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Modern conveniences for native JavaScript promises.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"prepublish": "npm test && eslint ." | ||
}, | ||
@@ -9,0 +10,0 @@ "repository": { |
@@ -1,8 +0,31 @@ | ||
convenient | ||
mod-cons | ||
=========== | ||
 | ||
 | ||
 | ||
 | ||
 | ||
 | ||
Modern conveniences for native JavaScript promises. | ||
Modern conveniences for native JavaScript promises. | ||
Have you switched to native promises but miss the convenience of | ||
`Q.nfcall`? This library contains a low-footprint reimplementations of | ||
[Q] convenience functions meant to be run on top of native ES5 | ||
promises. | ||
No messy dependencies. No half-baked home-rolled Promise | ||
implementation. No wrappers. | ||
- [ninvoke / nsend][ninvoke] | ||
- [nfcall] | ||
- [nfapply] | ||
- [nfbind / denodeify][nfbind] | ||
- [nbind] | ||
- [npost / nmapply][npost] | ||
[Q]:https://github.com/kriskowal/q/ | ||
[ninvoke]:https://github.com/kriskowal/q/wiki/API-Reference#qninvokeobject-methodname-args | ||
[nfcall]:https://github.com/kriskowal/q/wiki/API-Reference#qnfcallfunc-args | ||
[nfapply]:https://github.com/kriskowal/q/wiki/API-Reference#qnfapplynodefunc-args | ||
[nfbind]:https://github.com/kriskowal/q/wiki/API-Reference#qnfbindnodefunc-args | ||
[npost]:https://github.com/kriskowal/q/wiki/API-Reference#qnpostobject-methodname-args | ||
[nbind]:https://github.com/kriskowal/q/wiki/API-Reference#qnbindnodemethod-thisarg-args |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32
255.56%4785
-15.32%11
-15.38%84
-42.07%1
Infinity%