Skip to content

Commit 771cba6

Browse files
committed
Merge branch 'main' into alpha
2 parents 0652ab3 + b118fde commit 771cba6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,19 @@ export function partitionWhileFn<T>(
863863
return array => partitionWhile(array, predicate);
864864
}
865865

866+
export function partitionUntil<T>(
867+
array: ArrayLike<T>,
868+
predicate: (element: T) => boolean
869+
): [T[], T[]] {
870+
return partitionWhile(array, element => !predicate(element));
871+
}
872+
873+
export function partitionUntilFn<T>(
874+
predicate: (element: T) => boolean
875+
): (array: ArrayLike<T>) => [T[], T[]] {
876+
return array => partitionUntil(array, predicate);
877+
}
878+
866879
/** Takes two arrays and returns an array of corresponding pairs.
867880
*
868881
* If one of the supplied arrays is shorter than the other, then the excess

0 commit comments

Comments
 (0)