5 ms·
> Lodash is currently > 12k lines of code, and Underscore is 1.5k. Never knew that before. Does Lodash have more features than Underscore? I never got too heav
by fokinsean 11y ago
> Lodash is currently > 12k lines of code, and Underscore is 1.5k.
Never knew that before. Does Lodash have more features than Underscore? I never got too heavy into using either but I always thought of them as essentially being interchangeable libraries.
- Derander 11y agoLodash has many features that underscore does not have. Also, I am told that Lodash has been implemented in such a way that functions are largely independent of each other so that you can build a custom lodash package that only includes the subset that you use.
- tracker1 11y agoIn practice, I'm not sure how truly valuable this is... it's far easier to just accept it as a whole, and with min/merge versions in the browser it's not so big at all. It's not a macro framework like jQuery... the kitchen sink isn't in there... though, I do think that probably the string templating could/should become a sub-module... the rest belong together more.
- betenoire 11y agoThe comments mentions this a few times: the codebases are different styles and the size difference apparently has a lot to do with documentation.
- mmgutz 11y agoIn addition to other comments, optimization sometimes means inlining code. Lodash has always been performance first.
- jdd 11y agolodash is consistency and compatibility first.
- ben336 11y agoHeres a breakdown of the differences between the two : http://benmccormick.org/2014/11/12/underscore-vs-lodash/ http://benmccormick.org/2014/11/12/underscore-vs-lodash/ A few months old but should still be reasonably accurate
- Cthulhu_ 11y agoOne of the core differences between Lodash - iirc - is that Underscore will just use a browser's built-in version of functions like .map and such, while Lodash often implements them themselves - circumventing JS spec compliance, often with significantly better performance than native implementations.
- Vekz 11y ago> circumventing JS spec compliance, often with significantly better performance than native implementations. Yes Lodash has some interesting 'better than native' optimizations that utilize JIT compilation