You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 rivejä
730 B

3 vuotta sitten
  1. var createFind = require('./_createFind'),
  2. findLastIndex = require('./findLastIndex');
  3. /**
  4. * This method is like `_.find` except that it iterates over elements of
  5. * `collection` from right to left.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 2.0.0
  10. * @category Collection
  11. * @param {Array|Object} collection The collection to inspect.
  12. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13. * @param {number} [fromIndex=collection.length-1] The index to search from.
  14. * @returns {*} Returns the matched element, else `undefined`.
  15. * @example
  16. *
  17. * _.findLast([1, 2, 3, 4], function(n) {
  18. * return n % 2 == 1;
  19. * });
  20. * // => 3
  21. */
  22. var findLast = createFind(findLastIndex);
  23. module.exports = findLast;