1.0.1 • Published 7 years ago

async-composer v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

async-composer

a function for compose asynchronous functions or synchronous functions

npm.io

example

import asyncCompose from async-composer;

const f1 = a => `f1: ${a}`;

const f2 = b => `f2: ${b}`;

const f3 = c =>
  new Promise((r, j) => {
    setTimeout(() => r(c), 2000);
  });

console.log(asyncCompose([f1, f2])("f0"));  // f2: f1: f0

asyncCompose([f1, f2, f3])("f0").then(r => console.log("f3: " + r));    // after 2s:f3: f2: f1: f0
1.0.1

7 years ago

1.0.0

7 years ago