Skip to content

afeiship/next-promise-compose

Repository files navigation

next-promise-compose

Promise compose for next.

version license size download

installation

npm install -S @jswork/next-promise-compose

usage

import '@jswork/next-promise-compose';

const double = x => x * 2;
const square = x => x * x;
const plus3 = x => new Promise(resolve => setTimeout(() => resolve(x + 3), 100));

nx.promiseCompose(plus3, square, double)(2)
  .then(result => {
    console.log(result);  // 50
  })
  .catch(console.error);

license

Code released under the MIT license.