Security update for Core, with self-updated composer
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / dropWhile.js
1 var 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  * @category Array
12  * @param {Array} array The array to query.
13  * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
14  * @returns {Array} Returns the slice of `array`.
15  * @example
16  *
17  * var users = [
18  *   { 'user': 'barney',  'active': false },
19  *   { 'user': 'fred',    'active': false },
20  *   { 'user': 'pebbles', 'active': true }
21  * ];
22  *
23  * _.dropWhile(users, function(o) { return !o.active; });
24  * // => objects for ['pebbles']
25  *
26  * // The `_.matches` iteratee shorthand.
27  * _.dropWhile(users, { 'user': 'barney', 'active': false });
28  * // => objects for ['fred', 'pebbles']
29  *
30  * // The `_.matchesProperty` iteratee shorthand.
31  * _.dropWhile(users, ['active', false]);
32  * // => objects for ['pebbles']
33  *
34  * // The `_.property` iteratee shorthand.
35  * _.dropWhile(users, 'active');
36  * // => objects for ['barney', 'fred', 'pebbles']
37  */
38 function dropWhile(array, predicate) {
39   return (array && array.length)
40     ? baseWhile(array, baseIteratee(predicate, 3), true)
41     : [];
42 }
43
44 module.exports = dropWhile;