1 var baseFindIndex = require('./_baseFindIndex'),
2 baseIteratee = require('./_baseIteratee');
5 * This method is like `_.findIndex` except that it iterates over elements
6 * of `collection` from right to left.
11 * @param {Array} array The array to search.
12 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
13 * @returns {number} Returns the index of the found element, else `-1`.
17 * { 'user': 'barney', 'active': true },
18 * { 'user': 'fred', 'active': false },
19 * { 'user': 'pebbles', 'active': false }
22 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
25 * // The `_.matches` iteratee shorthand.
26 * _.findLastIndex(users, { 'user': 'barney', 'active': true });
29 * // The `_.matchesProperty` iteratee shorthand.
30 * _.findLastIndex(users, ['active', false]);
33 * // The `_.property` iteratee shorthand.
34 * _.findLastIndex(users, 'active');
37 function findLastIndex(array, predicate) {
38 return (array && array.length)
39 ? baseFindIndex(array, baseIteratee(predicate, 3), true)
43 module.exports = findLastIndex;