mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Cleanup _.dropRightWhile and _.takeRightWhile.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -3507,12 +3507,11 @@
|
|||||||
* // => ['barney', 'fred']
|
* // => ['barney', 'fred']
|
||||||
*/
|
*/
|
||||||
function dropRightWhile(array, predicate, thisArg) {
|
function dropRightWhile(array, predicate, thisArg) {
|
||||||
var length = array ? array.length : 0,
|
var length = array ? array.length : 0;
|
||||||
index = length;
|
|
||||||
|
|
||||||
predicate = getCallback(predicate, thisArg, 3);
|
predicate = getCallback(predicate, thisArg, 3);
|
||||||
while (index-- && predicate(array[index], index, array)) {}
|
while (length-- && predicate(array[length], length, array)) {}
|
||||||
return slice(array, 0, index + 1);
|
return slice(array, 0, length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4293,12 +4292,11 @@
|
|||||||
* // => ['pebbles']
|
* // => ['pebbles']
|
||||||
*/
|
*/
|
||||||
function takeRightWhile(array, predicate, thisArg) {
|
function takeRightWhile(array, predicate, thisArg) {
|
||||||
var length = array ? array.length : 0,
|
var length = array ? array.length : 0;
|
||||||
index = length;
|
|
||||||
|
|
||||||
predicate = getCallback(predicate, thisArg, 3);
|
predicate = getCallback(predicate, thisArg, 3);
|
||||||
while (index-- && predicate(array[index], index, array)) {}
|
while (length-- && predicate(array[length], length, array)) {}
|
||||||
return slice(array, index + 1);
|
return slice(array, length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user