For some reason I've thought I needed a function for doing function composition. My real intention was to use something to pipe results from one computation to another as composition passes the value from right to left.
This article about Pipe Function in JavaScript has provided help in remembering what I wanted to achieve.
In fact I have seen this many times before in staltz/callbag-pipe and RxJS.
To enable the option to compose pipelines out of smaller parts with async code, all functional helpers would need to be able to work with Promises.
const fetchUser = id =>
fetch('/user/' + id)
.then(res => res.json())
const fn = pipe(
fromPromise(fetchUser),
map(x => x + 1),
withDefault(10)
)
const id = await fn(10023)
- eslint/generator-eslint Yeoman generator ofr ESLint plugins and rules.
- Writing Custom Lint Rules for Your Picky Developers article about writing a simple ESLint rule.
- Working with Rules official ESLint docs about writing rules.