Skip to content

Instantly share code, notes, and snippets.

View frentsel's full-sized avatar

Frentsel Alexandr frentsel

  • frentsel
  • Ukraine
View GitHub Profile
@frentsel
frentsel / es6-compose.md
Last active December 10, 2018 17:38 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduce((prevFn, nextFn) =>
    (...args) => prevFn(nextFn(...args)),
    (value) => value);