bbo
Version:
bbo is a utility library of zero dependencies for javascript.
24 lines (18 loc) • 515 B
JavaScript
;
require('./get_tag.js');
require('./is_array.js');
require('./is_string.js');
require('./is_map.js');
require('./is_set.js');
var size = require('./size.js');
/**
* Removes elements from the end of an array until the passed function returns true,
* Returns the remaining elements in the array.
*/
function dropRightWhile(arr, func) {
var rightIndex = size(arr);
while (rightIndex-- && !func(arr[rightIndex])) {
}
return arr.slice(0, rightIndex + 1);
}
module.exports = dropRightWhile;