UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

11 lines (9 loc) 253 B
function dropRightWhile(arr, canContinueDropping) { for (let i = arr.length - 1; i >= 0; i--) { if (!canContinueDropping(arr[i], i, arr)) { return arr.slice(0, i + 1); } } return []; } export { dropRightWhile };