findIndex (array, fn) {
    let index = -1
    if (!array) {
      return index
    }
    array.forEach(function (record, i) {
      if (fn(record)) {
        index = i
        return false
      }
    })
    return index
  }
Find the last index of an item in an array according to the given checker function.

@example
import { utils } from 'js-data';

const john = { name: 'John', age: 20 };
const sara = { name: 'Sara', age: 25 };
const dan = { name: 'Dan', age: 20 };
const users = [john, sara, dan];

console.log(utils.findIndex(users, (user) => user.age === 25)); // 1
console.log(utils.findIndex(users, (user) => user.age > 19)); // 2
console.log(utils.findIndex(users, (user) => user.name === 'John')); // 0
console.log(utils.findIndex(users, (user) => user.name === 'Jimmy')); // -1

@method utils.findIndex
@param {array} array The array to search.
@param {Function} fn Checker function.
@returns {number} Index if found or -1 if not found.
@since 3.0.0