Neatly Prepared Mustache
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

apr-compose

3.0.3 • Public • Published

compose

Creates a function which is a composition of the passed asynchronous functions. Each function consumes the return value of the function that follows. Composing functions f(), g(), and h() would produce the result of f(g(h())).

Parameters

Examples

import compose from 'apr-compose';
 
const then = (v) => new Promise((resolve) => resolve(v));
 
const composed = compose(
  async (v) => await then(+ 1),
  async (v) => await then(+ 2),
  async (v) => await then(+ 3)
);
 
const output = await composed(1); // 7

Returns Function

install

npm i apr-compose

Downloadsweekly downloads

2

version

3.0.3

license

MIT

homepage

apr.js.org

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability