es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
15 lines (11 loc) • 364 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function takeRightWhile(arr, shouldContinueTaking) {
for (let i = arr.length - 1; i >= 0; i--) {
if (!shouldContinueTaking(arr[i], i, arr)) {
return arr.slice(i + 1);
}
}
return arr.slice();
}
exports.takeRightWhile = takeRightWhile;