In the first few paragraphs of this post I outline three kinds of general objects, one of which is an array, another is an array like object, and the final one is a kind of named collection or associative array as it might some times be called. All of these kinds of objects hold one thing in common, they are all a kind of collection. Each of these kinds of objects have zero or more public keys and each of those public keys have some kind of value that correspond to it. However there are also the differences, for example the object that is an array will have the array map method at the ready to work with, however that is not the case with the array like object, or the associative array. A collection method is then a kind of method that is designed to work with any of these kinds of objects, right out of the gate, without having do something before hand to convert types, or get one class of object to work with another.
Now that I have the basics of what a collection is to begin with out of the way I can now take a moment to run over some of the collection methods to work with in lodash. There are a lot to choose from, some of which will just loop over the contents of a collection, others preform very specific tasks that will only prove to be useful in rare cases, and even then it is not to hard to do the same with another more common option. So I will not be going over every little method that there is to write about in this section, but I will of course be writing about the common ones.
I all ready covered the lodash for each method, so I will not be going over this method again in to much detail. I all ready wrote another post on the lodash for each method, so much of the various little additional features are outline there.
The count by collection method will return a new object with a count for each value for a given property.
The filter collection method will return a new array with elements that just meet a given condition.
The lodash find method can be used to find a single item in a collection.