News for hackers. Stuff that matters.
Re:You-Dont-Need-Lodash-Underscore by adregan on Friday August 09, 2019 @02:24PM (#20657037)
I wouldn't recommend mixing those two libraries as they often do _very_ different things with the same name (eg. `chain` in ramda is `flatMap`) but also because ramda mostly flips the arguments of most functions.

For example, `map` takes the function first and then the collection. That's handy because everything is curried so you can partially apply map:

    const double = R.map(x => x * 2);
and can build up helper functions. Something similar in lodash would be:

    const double = (collection) => _.map(collection, x => x * 2);
which there is nothing wrong with, it's just that the first is more ergonomic with `pipe` (and the potential future feature pipeline operator `|>`).

That said, it took a while to adopt at work. It wasn't until we had a critical mass of people who enjoyed functional programming that it really took off. Before that time, we used a few methods lightly (utils like `pathOr` and `propOr` are so nice when you want to safely traverse an object without `o && o.foo && o.foo.bar`) and were very conscious that it might not be everyone's cup of tea.

There are no comments on this comment yet.