diff --git a/index.ts b/index.ts index 10089f9e..a9ba5441 100644 --- a/index.ts +++ b/index.ts @@ -861,6 +861,19 @@ export function partitionWhileFn( return array => partitionWhile(array, predicate); } +export function partitionUntil( + array: ArrayLike, + predicate: (element: T) => boolean +): [T[], T[]] { + return partitionWhile(array, element => !predicate(element)); +} + +export function partitionUntilFn( + predicate: (element: T) => boolean +): (array: ArrayLike) => [T[], T[]] { + return array => partitionUntil(array, predicate); +} + /** Takes two arrays and returns an array of corresponding pairs. * * If one of the supplied arrays is shorter than the other, then the excess