1.1.1 • Published 9 years ago

promise-fncall v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

promise-fncall

Build status NPM version js-xo-style

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)

NameTypeDescription
fnFunction|Promise { [Function] }The function, or a promise resolving to a function, to call with the resolved promises as arguments
...promisesPromiseThe 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