The lodash \_.method method as well as other methods of interest
The lodash _.method method can be used to call a method at a given path when used with another lodash method like _.map, or _.filter just to name a few such options. In other words say you have this function as a property of an object that is one of many such objects in a collection of sorts, and you want to use this function with a method like map to create a custom form of the collection. If you are in this kind of situation then this is a situation in which you might consider using the lodash _.method method.
1 - The lodash _.method basics
1.1 - Basic example of the method lodash method in range example
So then say I have an in range method that will return true if the x value of an object is in a given range, and false if it is not. I then have a reference to this in range method in a bunch of nested objects in a collection along with an x value that will work with the range method. I then want to create a new array that is just the objects in the collection that contain an x value that is in range. So then I could do something with the lodash _.method like this.
1.2 - Not using the method lodash method
Often it is not going to end up being to much more complex to avoid having to use this method. Also if I am using it I can not help but think that the use of the method like this proves that I should be doing something different with the state of a collection. For example in the in rage example that I started out with why would I have references to an in range method like that for each object? Why not just call the in range method directly in the body of a function that I give to the filter method with the call function prototype method and just pass a reference to the nested object?
Maybe it would make more sense if each nested object in the collection had its own unique method, but even in that case why not just do something like this? Also why even use lodash to do something like this also? I do not want to be yet another developer that jumps on the lodash hate wagon really, there are a few methods in lodash that I think are very useful, but that is just it, a few. If this method is one of those methods in lodash I can not say that I am seeing it.
3 - Conclusion
Thats it for now today, I could not think about more to write about with this one just yet, and could also not come up with any actual real use case examples as well fir the method named method in lodash. I can not say that I end up in situations in which I need to use this kind of method often, in fact thus far I would say never actually. Even if I do get into some kind of situation in which this method will prove to be useful I think I would still prefer to make use of some other options for doing what I need to do actually.