Sha256: 2a025991b00736a5ef4fe7b7ad5a436d26355c3a35a2bc8cd7967327a8622fdb
Contents?: true
Size: 1 KB
Versions: 14
Compression:
Stored size: 1 KB
Contents
var baseCallback = require('../internal/baseCallback'), baseEachRight = require('../internal/baseEachRight'), baseFind = require('../internal/baseFind'); /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); * // => 3 */ function findLast(collection, predicate, thisArg) { predicate = baseCallback(predicate, thisArg, 3); return baseFind(collection, predicate, baseEachRight); } module.exports = findLast;
Version data entries
14 entries across 7 versions & 1 rubygems