findLastIndexBy (source code)
- Curried: true
- Failsafe status: alternative available
The findLastIndexBy
function finds the last index of an item in the array that
matches the provided pattern.
pattern
: The pattern using which an object will be matched.entityArray
: The array of objects in which the object with the given pattern will be searched.
const array = [
{ name: "Oliver", age: 20 },
{ name: "Sam", age: 40 },
{ name: "George", age: 41 },
{ name: "Smith", age: 20 },
];
findLastIndexBy({ age: 20 }, array); // returns 3
findLastIndexBy({ name: includes("e") }, array); // returns 2