Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

findKey.js 408B

123456789101112131415
  1. define(['./keys', './_cb'], function (keys, _cb) {
  2. // Returns the first key on an object that passes a truth test.
  3. function findKey(obj, predicate, context) {
  4. predicate = _cb(predicate, context);
  5. var _keys = keys(obj), key;
  6. for (var i = 0, length = _keys.length; i < length; i++) {
  7. key = _keys[i];
  8. if (predicate(obj[key], key, obj)) return key;
  9. }
  10. }
  11. return findKey;
  12. });