6 ms·
Lodash gets so many things wrong I’d rather not see it in most projects. I appreciate a good utility library for JS projects but my go-to choice has to be Ramd
by Rumudiez 4y ago
Lodash gets so many things wrong I’d rather not see it in most projects. I appreciate a good utility library for JS projects but my go-to choice has to be Ramda[1]. Every function it exports is curried and works great with pipe which enables me to write highly reusable and composable functions in pointfree notation. I have never been as productive with lodash, and I find the functional style easier to read
[1] https://ramdajs.com/ https://ramdajs.com/
- beardedetim 4y agoCannot recommend Ramda enough. It's a great utility belt to build your application with. Only downside is the pushback I always receive from the team when I try to introduce it.
- ASalazarMX 4y agoReading the insightful comments in this post, I see why accommodating JavaScript's inherent flaws has snowballed web development. You need to know concepts like tree-shaking (removal of dead code) to pick among 10 different libraries that mostly do the same in subtly different ways.
- recursive 4y agoWhat is "pipe"? Surely you're not referring to the bitwise-or operator `|`?
- dvlsg 4y agoRamda has a composition (left to right) function named pipe: https://ramdajs.com/docs/#pipe https://ramdajs.com/docs/#pipe It's similar to the pipe operator seen in other languages (Elixir, F#, etc). There is a proposal to add a pipe operator to JS as well - still in early stages, though.
- Rumudiez 4y agoIt’s for connecting functions together like a pipeline, the same as compose but the fn list is reversed. Lodash has something similar called chain, but that’s harder to extend and isn’t as portable as partially applied functions
- letmeinhere 4y agoI've similarly enjoyed Remeda for first-class Typescript support, though I don't know it intimately and it is a much smaller project.
- papaver 4y agoif you enjoy functional programming and are looking for a utility library, ramda has been a joy. very very well thought out. being able to compose functions together and treat data as a stream of information being transformed is incredibly easy. it is also compatible with libraries which implement algebraic structures like fantasy land. coupled with the other r libs its quite fun to program with. just be careful as it gets hairy to read pretty fast if one doesn't understand all the functions that come into play... // pull traits dictionary out of tokens const extractTraits = R.pipe( R.map(R.pipe( R.last, R.prop('attributes'))), R.reject(R.isNil), R.reduce(R.mergeWith(concatValues), {}), R.map(R.pipe( R.unless(R.is(Array), R.of), R.groupBy(R.identity), R.map(R.count(R.identity)), R.toPairs, R.sortBy(R.prop(0)), R.map(R.zipObj(['name', 'count'])))));
- satvikpendem 4y agoHow does it compare with fp-ts?
- quest88 4y agoWhat does it get wrong