Skip to content

Instantly share code, notes, and snippets.

@hesan-aminiloo
Last active January 10, 2023 17:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hesan-aminiloo/ba1687a19f57e8284caa6b3bef52635f to your computer and use it in GitHub Desktop.
Save hesan-aminiloo/ba1687a19f57e8284caa6b3bef52635f to your computer and use it in GitHub Desktop.
/**
* Compose multiple functions together
*
* @param fns Array of funcitons
* @returns function
*/
const compose = (...fns) => (param) =>
fns.reduceRight((y, f) => f(y), param);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment