Skip to content

A better implementation of the "compose" FP function that allows for composing both synchronous and asynchronous functions.

Notifications You must be signed in to change notification settings

jperasmus/compose-then

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

compose-then

A better implementation of the "compose" FP function that allows for composing both synchronous and asynchronous functions.

Installation:

yarn add compose-then

or

npm install --save compose-then

Example:

import compose from 'compose-then';

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

compose(double, square, plus3)(2)
  .then(result => // Result equals 50)
  .catch(console.error);

About

A better implementation of the "compose" FP function that allows for composing both synchronous and asynchronous functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published