1 var createFind = require('./_createFind'),
2 findIndex = require('./findIndex');
5 * Iterates over elements of `collection`, returning the first element
6 * `predicate` returns truthy for. The predicate is invoked with three
7 * arguments: (value, index|key, collection).
12 * @category Collection
13 * @param {Array|Object} collection The collection to inspect.
14 * @param {Function} [predicate=_.identity] The function invoked per iteration.
15 * @param {number} [fromIndex=0] The index to search from.
16 * @returns {*} Returns the matched element, else `undefined`.
20 * { 'user': 'barney', 'age': 36, 'active': true },
21 * { 'user': 'fred', 'age': 40, 'active': false },
22 * { 'user': 'pebbles', 'age': 1, 'active': true }
25 * _.find(users, function(o) { return o.age < 40; });
26 * // => object for 'barney'
28 * // The `_.matches` iteratee shorthand.
29 * _.find(users, { 'age': 1, 'active': true });
30 * // => object for 'pebbles'
32 * // The `_.matchesProperty` iteratee shorthand.
33 * _.find(users, ['active', false]);
34 * // => object for 'fred'
36 * // The `_.property` iteratee shorthand.
37 * _.find(users, 'active');
38 * // => object for 'barney'
40 var find = createFind(findIndex);
42 module.exports = find;