diff --git a/snippets/pipeAsyncFunctions.md b/snippets/pipeAsyncFunctions.md index 921de2bd4..9ab98d230 100644 --- a/snippets/pipeAsyncFunctions.md +++ b/snippets/pipeAsyncFunctions.md @@ -5,9 +5,9 @@ tags: function,promise,intermediate Performs left-to-right function composition for asynchronous functions. -Use `Array.prototype.reduce()` with the spread operator (`...`) to perform left-to-right function composition using `Promise.then()`. -The functions can return a combination of: simple values, `Promise`'s, or they can be defined as `async` ones returning through `await`. -All functions must be unary. +Use `Array.prototype.reduce()` and the spread operator (`...`) to perform function composition using `Promise.then()`. +The functions can return a combination of normal values, `Promise`s or be `async`, returning through `await`. +All functions must accept a single argument. ```js const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));