mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
17
dropWhile.js
17
dropWhile.js
@@ -1,4 +1,3 @@
|
||||
import baseIteratee from './_baseIteratee.js';
|
||||
import baseWhile from './_baseWhile.js';
|
||||
|
||||
/**
|
||||
@@ -11,7 +10,7 @@ import baseWhile from './_baseWhile.js';
|
||||
* @since 3.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
@@ -23,22 +22,10 @@ import baseWhile from './_baseWhile.js';
|
||||
*
|
||||
* _.dropWhile(users, function(o) { return !o.active; });
|
||||
* // => objects for ['pebbles']
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.dropWhile(users, { 'user': 'barney', 'active': false });
|
||||
* // => objects for ['fred', 'pebbles']
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.dropWhile(users, ['active', false]);
|
||||
* // => objects for ['pebbles']
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.dropWhile(users, 'active');
|
||||
* // => objects for ['barney', 'fred', 'pebbles']
|
||||
*/
|
||||
function dropWhile(array, predicate) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseIteratee(predicate, 3), true)
|
||||
? baseWhile(array, predicate, true)
|
||||
: [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user