Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rambda/mod.ts>splitWhen

Faster and smaller alternative to Ramda
Go to Latest
function splitWhen
import { splitWhen } from "https://deno.land/x/rambda@9.2.1/mod.ts";

It splits list to two arrays according to a predicate function.

The first array contains all members of list before predicate returns true.

Parameters

predicate: Predicate<T>
list: U[]

Returns

(U[])[]

Parameters

predicate: Predicate<T>

Returns

<U>(list: U[]) => (U[])[]