promise-fncall
v1.1.1
Published
A Function.call that can deal with promise arguments
Maintainers
Readme
promise-fncall
A Function.call that can deal with promise arguments
Installation
Install promise-fncall using npm:
npm install --save promise-fncallUsage
Module usage
var call = require('promise-fncall');
function greet(val) {
return 'hello ' + val;
}
call(greet, Promise.resolve('world'))
.then(function (val) {
// val === 'hello world'
});API
call(fn, ...promises)
| Name | Type | Description |
|------|------|-------------|
| fn | Function|Promise { [Function] }| The function, or a promise resolving to a function, to call with the resolved promises as arguments |
| ...promises | Promise| The arguments to pass to fn when they all are resolved |
Returns: Promise, which resolves to the result of calling fn with the resolved values of ...promises.
Related
License
MIT © Joakim Carlstein
