UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

40 lines (39 loc) 1.09 kB
/** * This method is like `findIndex` except that it iterates over elements * of `collection` from right to left. * * @since 5.2.0 * @category Array * @param array The array to inspect. * @param predicate The function invoked per iteration. * @param fromIndex The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * * ```js * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * * // The `matches` iteratee shorthand. * findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * * // The `matchesProperty` iteratee shorthand. * findLastIndex(users, ['active', false]); * // => 2 * * // The `property` iteratee shorthand. * findLastIndex(users, 'active'); * // => 0 * * ``` */ export declare function findLastIndex(array: any, predicate?: any, fromIndex?: number): number; export default findLastIndex;