where()

Retrieves a new array of all of the items in an array which match a list of rules.

This function is valid in v2.23.0. This function has been downloaded 2 times.

Parameters

{Array} array
The array whose values should be checked against all of the rules.
{…Array} ruleX
An array containing (1) the path, (2) optionally the comparator as a string and (3) the value to check the variable at that path against. Each part of the path should be a separate item in the array. For example [\"details\", \"age\", \">=\", 18] can be used to make sure that array[index].details.age >= 18 occurs. If no comparator is supplied === will be used. If one of the paths doesn't exist the entire test will fail.

Returns

{Array}
An array containing all of the items from array that passed all of the specified rules.

Required Function

This function directly requires the following function which is included automatically:

  • everyWhere()
    Determines whether a specific test passes for all of the items in an array.

Requiring Function

This function is directly required by the following function:

  • everyWhere()
    Determines whether a specific test passes for all of the items in an array.