source: trip-planner-front/node_modules/lodash/dropWhile.js@ 76712b2

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

initial commit

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[6a3a178]1var baseIteratee = require('./_baseIteratee'),
2 baseWhile = require('./_baseWhile');
3
4/**
5 * Creates a slice of `array` excluding elements dropped from the beginning.
6 * Elements are dropped until `predicate` returns falsey. The predicate is
7 * invoked with three arguments: (value, index, array).
8 *
9 * @static
10 * @memberOf _
11 * @since 3.0.0
12 * @category Array
13 * @param {Array} array The array to query.
14 * @param {Function} [predicate=_.identity] The function invoked per iteration.
15 * @returns {Array} Returns the slice of `array`.
16 * @example
17 *
18 * var users = [
19 * { 'user': 'barney', 'active': false },
20 * { 'user': 'fred', 'active': false },
21 * { 'user': 'pebbles', 'active': true }
22 * ];
23 *
24 * _.dropWhile(users, function(o) { return !o.active; });
25 * // => objects for ['pebbles']
26 *
27 * // The `_.matches` iteratee shorthand.
28 * _.dropWhile(users, { 'user': 'barney', 'active': false });
29 * // => objects for ['fred', 'pebbles']
30 *
31 * // The `_.matchesProperty` iteratee shorthand.
32 * _.dropWhile(users, ['active', false]);
33 * // => objects for ['pebbles']
34 *
35 * // The `_.property` iteratee shorthand.
36 * _.dropWhile(users, 'active');
37 * // => objects for ['barney', 'fred', 'pebbles']
38 */
39function dropWhile(array, predicate) {
40 return (array && array.length)
41 ? baseWhile(array, baseIteratee(predicate, 3), true)
42 : [];
43}
44
45module.exports = dropWhile;
Note: See TracBrowser for help on using the repository browser.