1 var baseForOwn = require('../internal/baseForOwn'),
2 createFindKey = require('../internal/createFindKey');
5 * This method is like `_.find` except that it returns the key of the first
6 * element `predicate` returns truthy for instead of the element itself.
8 * If a property name is provided for `predicate` the created `_.property`
9 * style callback returns the property value of the given element.
11 * If a value is also provided for `thisArg` the created `_.matchesProperty`
12 * style callback returns `true` for elements that have a matching property
13 * value, else `false`.
15 * If an object is provided for `predicate` the created `_.matches` style
16 * callback returns `true` for elements that have the properties of the given
17 * object, else `false`.
22 * @param {Object} object The object to search.
23 * @param {Function|Object|string} [predicate=_.identity] The function invoked
25 * @param {*} [thisArg] The `this` binding of `predicate`.
26 * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
30 * 'barney': { 'age': 36, 'active': true },
31 * 'fred': { 'age': 40, 'active': false },
32 * 'pebbles': { 'age': 1, 'active': true }
35 * _.findKey(users, function(chr) {
36 * return chr.age < 40;
38 * // => 'barney' (iteration order is not guaranteed)
40 * // using the `_.matches` callback shorthand
41 * _.findKey(users, { 'age': 1, 'active': true });
44 * // using the `_.matchesProperty` callback shorthand
45 * _.findKey(users, 'active', false);
48 * // using the `_.property` callback shorthand
49 * _.findKey(users, 'active');
52 var findKey = createFindKey(baseForOwn);
54 module.exports = findKey;