source: trip-planner-front/node_modules/lodash/find.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1var createFind = require('./_createFind'),
2 findIndex = require('./findIndex');
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
42module.exports = find;
Note: See TracBrowser for help on using the repository browser.