mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import baseCallback from '../internal/baseCallback';
|
||||
import baseSlice from '../internal/baseSlice';
|
||||
import baseWhile from '../internal/baseWhile';
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with elements taken from the end. Elements are
|
||||
* taken until `predicate` returns falsey. The predicate is bound to `thisArg`
|
||||
* and invoked with three arguments; (value, index, array).
|
||||
* and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
@@ -51,13 +51,9 @@ import baseSlice from '../internal/baseSlice';
|
||||
* // => []
|
||||
*/
|
||||
function takeRightWhile(array, predicate, thisArg) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
while (length-- && predicate(array[length], length, array)) {}
|
||||
return baseSlice(array, length + 1);
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseCallback(predicate, thisArg, 3), false, true)
|
||||
: [];
|
||||
}
|
||||
|
||||
export default takeRightWhile;
|
||||
|
||||
Reference in New Issue
Block a user