The lodash property method
The lodash _.property method is one of several methods in lodash that can be used to create a method that is to be used with another lodash method such as _.find or _.map. The lodash property method returns a method that when used with a lodash method like _.map will return a property of an element object in an array. So lets look at some simple quick examples of this method to see what the lodash property method is all about, and also if it is not that big of a deal to not even bother with it.
1 - Basic example of _.property
The _.property can be used as a stand alone method, by calling it with a given path in string format it will then return a method that ca be used by calling the method with an object, and then it will return the value of the path.
For example say you have a collection of objects that have a value at a given path in each object, such as a current hp value in an hp object, along with other relevant values. In this case the _.property method can be used to make a method that will get a value at that path if it is there, else it will returned undefined.
So there you have it there is a basic example of the lodash property method. Oddly enough this is a topic that comes up now and then. Say I have a value that is at a lengthly name space of sorts in a bunch of nested objects, something that does come up now and then. There is just typing out that lengthly chain of object property names each time, but then there is saving a reference to a variable, or using some other way of doing so such as using the lodash property method.
1.1 - Other ways to get a property including lodash get method, variables, and the with statement
In any case lets look at out basic example again this time doing the same thing with these other options I have mentioned.
2 - Using _.map with _.property
Many real life uses for _.property might be used with _.map. If I am every in a situation in which I want a whole bunch of values that exist at a certain path in a bunch of objects fattened down into a simple array of primitives that can be done very quickly using _.property with _.map.