* This method is like `_.findIndex` except that it returns the key of the * first element that passes the callback check, instead of the element itself. * * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the
(object, callback, thisArg)
| 37053 | * // => 'fred' |
| 37054 | */ |
| 37055 | function findKey(object, callback, thisArg) { |
| 37056 | var result; |
| 37057 | callback = lodash.createCallback(callback, thisArg, 3); |
| 37058 | forOwn(object, function(value, key, object) { |
| 37059 | if (callback(value, key, object)) { |
| 37060 | result = key; |
| 37061 | return false; |
| 37062 | } |
| 37063 | }); |
| 37064 | return result; |
| 37065 | } |
| 37066 | |
| 37067 | /** |
| 37068 | * This method is like `_.findKey` except that it iterates over elements |