The lodash _.some collection method can be used to test to see if just one element of an array, or key value pair of an object in general meets a given condition. There is another collection method known as _.every that works in a similar way to that of the _.some method but will only return true when all elements of a collection meet a given condition.
The lodash some method is used to quickly find out if at least one element in a collection meets a given condition. To use it just call the _.some method followed by the collection that is to be tested, followed by a function that will be used to test potentially all elements in the collection for a certain condition.
So it is not to hard to just use a while loop for example to loop over the contents of an array and check to see if one element in the array meets a certain condition of course.
It is not to hard to write a some method of my own. The Object.keys method can be used to get all publc keys of an Object in general. This can then be used as a way to loop over all they keys and call a given test function that will return true if an element meets the desired condition. Such a method will work just fine with most Arrays and Object collections in general.
So if all clients that are of concern support it, there is also a native option for this sort of thing in the Array prototype.
One draw back might be that it is an array prototype method and not a collection method like in lodash. No problem thous as this is easily fixed with just the use of one more additional native method which would be the Object.values static Object method.
So the native Array.some method works okay on all clients concerned and you want to just go ahead and use that as a way to preform these kinds of tests. There is just one little problem and that is that it is an array prototype method rather than a collection method like in lodash. So when you want to use it with objects in general, you can not just go ahead and do so with just the native array some method.
So there is then a need to make a stand alone some method that is part of you r own framework for you pro9ject just like in lodash once again. If you do not just want to use lodash and move on with it then it is not to hard to just make a native equivalent with just the native array some method and then the object.values static Object method.
The lodash some method as well as the native equivalent, or any other non lodash user space solution for what is often refer to as some, is just a way to check if all elements in an array meet a given condition. Preforming such a task really just involves just looping over all elements of an array, or collection, and preform a test for each element. If just one test results in a true result, then the process can be stopped and a true value for the some operation can be observed.