Без опису

123456789101112
  1. var _isArrayLike = require('./_isArrayLike.js');
  2. var findIndex = require('./findIndex.js');
  3. var findKey = require('./findKey.js');
  4. // Return the first value which passes a truth test.
  5. function find(obj, predicate, context) {
  6. var keyFinder = _isArrayLike(obj) ? findIndex : findKey;
  7. var key = keyFinder(obj, predicate, context);
  8. if (key !== void 0 && key !== -1) return obj[key];
  9. }
  10. module.exports = find;