source: imaps-frontend/node_modules/lodash-es/find.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[d565449]1import createFind from './_createFind.js';
2import findIndex from './findIndex.js';
3
4/**
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).
8 *
9 * @static
10 * @memberOf _
11 * @since 0.1.0
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`.
17 * @example
18 *
19 * var users = [
20 * { 'user': 'barney', 'age': 36, 'active': true },
21 * { 'user': 'fred', 'age': 40, 'active': false },
22 * { 'user': 'pebbles', 'age': 1, 'active': true }
23 * ];
24 *
25 * _.find(users, function(o) { return o.age < 40; });
26 * // => object for 'barney'
27 *
28 * // The `_.matches` iteratee shorthand.
29 * _.find(users, { 'age': 1, 'active': true });
30 * // => object for 'pebbles'
31 *
32 * // The `_.matchesProperty` iteratee shorthand.
33 * _.find(users, ['active', false]);
34 * // => object for 'fred'
35 *
36 * // The `_.property` iteratee shorthand.
37 * _.find(users, 'active');
38 * // => object for 'barney'
39 */
40var find = createFind(findIndex);
41
42export default find;
Note: See TracBrowser for help on using the repository browser.