lastIndexWhere()

Finds the position of the last item in an array which matches the specified criteria.

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

Parameters

{Array|null|undefined} array
If an array is given each item will be traversed from end to start to find the position of the last item which matches the given rules. If undefined or null is given then a partial lastIndexWhere() function is created with just the rules that were given which will accept only the array parameter.
{…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

{number}
The index of the last value in array which passes all of the specified rules. If no matches are found -1 will be returned.

Required Function

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

  • findWhere()
    Finds the first item in an array which matches the specified criteria.

Requiring Function

This function is directly required by the following function:

  • findWhere()
    Finds the first item in an array which matches the specified criteria.