lodash main post from why bother to getting started and beyond.
Many of the methods in lodash are in line with the concepts of functional programming such as conforming to rules that are constant with the concept of a pure function. That is a function in which the same result is returned for the same set of arguments that are given when the function is called.
It is true that many of the functions in lodash are from underscore the older library from which lodash was forked. At first it was stated that lodash would work as a drop in replacement for underscore, but with late versions of lodash that is no longer the case as there are many differences when it comes to the public APIS of these two projects.
1 - lodash basics and what to know first
Still there are the redeeming qualities of lodash that still remain to this day, and as such it still is very much in use, even with new projects. For example the lodash forEach method will work with objects in general rather than just arrays, and if the method that is passed to it returns false it will stop the loop. The idea that lodash helps to function as a safety net of sorts still remains true to this day to some extent, and it is still nice to abstract things away into a single framework or sorts. In addition even if you choose to not use lodash in new projects it is still a project that is worth studying because of the way that it is designed.
So in this post I will be just writing about lodash in general, and many of these topics that come to mind, this post will also serve as a sort of main index for all other lodash content on this site.
1.1 - The deal with array prototype methods and collections in general
1.2 - lodash forEach will work with collections in general
So then this is one major talking point about lodash beyond just that of the safety net idea that many developers thing that lodash is all about. The fact of the matter is that the safety net aspect is just one aspect of lodash, there are many others beyond just that. Do not get me wrong there are a lot of good reasons to decide not to use lodash, but it is a good idea to be aware of what the full picture is with lodash in the sense that it is a bot more than just simply a safety net.
2 - lodash relevancy in light of ecmascript 2015+
2.1 - Many lodash methods do not have a native counterpart.
First off there are many methods in lodash in which there is no native counterpart, and as such having them there at the ready helps save me the economy of time that I would spend writing my own solution. There are a lot of methods that come to mind when it comes to this, maybe the best one that I can think of off the bat would be the lodash chunk method. This chunk method will break an array of one dimension into an array of arrays. There is also the lodash flatten method that will do an inversion of this, but there is a native array flat method for this.
2.2 - Some lodash counterparts to native methods bring a bit more to the table
Second there are many lodash methods like _.map, and _.forEach that are collection methods rather than Array methods. Which means that they will work just fine with a wider range of objects that are objects with a collection of key value pairs in general. Also the _.forEach method in lodash behaves a little differently allowing me to return a boolean value to break out of the forEach loop, so there is often additional functionality added that does sometimes bring a little more to the table compared to what the native method alone will do.
2.3 - lodash methods can be installed on an individual basis
3 - lodash methods
3.1 - lodash array methods.
3.2 - lodash collection methods
The thing here is that regardless if I am dealing with an array that has numbered property keys and values, or just an object with names keys and values, in either case I am dealing with something that is a collection of sorts. So there is a desire to have robust collection methods that will work just fine with any kind of object that is treated as a collection.
3.3 - lodash object methods
4 - Conclusion
This post like many others on my site here is a work in progress, as time progresses I will likely update this post several times. If you can think of anything that I should add please let me know in the comments. In any case thank you for reading.