Comment

Comment by ozuly

I use a similar pattern in my typescript code by using the Remeda library[0]. Like the patterns described in the article, the util functions can be used in both a one-off data-first way:

    R.map(arr, (x) => x + 1)

and as part of a pipe in a data-last way:

    R.pipe(
      [0, 1, 2, 3, 4, 5, 6],
      R.map((x) => x + 1),
      R.filter((x) => x % 2 === 0),
      R.take(1)
    )

I've really enjoyed using it and would recommend it to anyone who would like to write their typescript in a more functional way.

[0] https://remedajs.com/

parent ozuly 2 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton