c74c036217b5f499ccb0cebcd6eb17be83886720a2a25b62bbfe6c7d89033ae84e5b7719860e6eb21bd17cd1448193de5de0db2062a27d63d7e7630c1e99a3 745 B

1234567891011121314151617181920212223
  1. /**
  2. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  3. * without support for iteratee shorthands, which iterates over `collection`
  4. * using `eachFunc`.
  5. *
  6. * @private
  7. * @param {Array|Object} collection The collection to inspect.
  8. * @param {Function} predicate The function invoked per iteration.
  9. * @param {Function} eachFunc The function to iterate over `collection`.
  10. * @returns {*} Returns the found element or its key, else `undefined`.
  11. */
  12. function baseFindKey(collection, predicate, eachFunc) {
  13. var result;
  14. eachFunc(collection, function(value, key, collection) {
  15. if (predicate(value, key, collection)) {
  16. result = key;
  17. return false;
  18. }
  19. });
  20. return result;
  21. }
  22. export default baseFindKey;