Skip to main content
variable takeRightWhile
import { takeRightWhile } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Removes elements from the end of an array until the passed function returns true. Returns the removed elements.

Loop through the array, using a Array.prototype.reduceRight() and accumulating elements while the function returns falsy value.

type

(arr: any[], func: Predicate) => unknown