Skip to content

Instantly share code, notes, and snippets.

@matthewstokeley
Last active May 5, 2019 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewstokeley/175303413a07445a36383c9c9ab8a55d to your computer and use it in GitHub Desktop.
Save matthewstokeley/175303413a07445a36383c9c9ab8a55d to your computer and use it in GitHub Desktop.
chain a sequence of functions
const chain = (array, arg) => {
let res = arg
? arg
: ''
for (let i = 0; i < array.length; ++i) {
res = array[i].call(this, res);
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment