createFindKey.js 524 B

123456789101112131415161718
  1. var baseCallback = require('./baseCallback'),
  2. baseFind = require('./baseFind');
  3. /**
  4. * Creates a `_.findKey` or `_.findLastKey` function.
  5. *
  6. * @private
  7. * @param {Function} objectFunc The function to iterate over an object.
  8. * @returns {Function} Returns the new find function.
  9. */
  10. function createFindKey(objectFunc) {
  11. return function(object, predicate, thisArg) {
  12. predicate = baseCallback(predicate, thisArg, 3);
  13. return baseFind(object, predicate, objectFunc, true);
  14. };
  15. }
  16. module.exports = createFindKey;