1.1.1 • Published 9 years ago
promise-fncall v1.1.1
promise-fncall
A Function.call that can deal with promise arguments
Installation
Install promise-fncall
using npm:
npm install --save promise-fncall
Usage
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