mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
@@ -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';
|
||||
*
|
||||
* _.dropRightWhile(users, function(o) { return !o.active; });
|
||||
* // => objects for ['barney']
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
|
||||
* // => objects for ['barney', 'fred']
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.dropRightWhile(users, ['active', false]);
|
||||
* // => objects for ['barney']
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.dropRightWhile(users, 'active');
|
||||
* // => objects for ['barney', 'fred', 'pebbles']
|
||||
*/
|
||||
function dropRightWhile(array, predicate) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseIteratee(predicate, 3), true, true)
|
||||
? baseWhile(array, predicate, true, true)
|
||||
: [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user