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

x/rambda/mod.ts>partition

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

It will return array of two objects/arrays according to predicate function. The first member holds all instances of input that pass the predicate function, while the second member - those who doesn't.

Parameters

predicate: Predicate<T>
input: T[]

Returns

[T[], T[]]

Parameters

predicate: Predicate<T>

Returns

(input: T[]) => [T[], T[]]

Parameters

predicate: (x: T, prop?: string) => boolean
input: { [key: string]: T; }

Returns

[{ [key: string]: T; }, { [key: string]: T; }]

Parameters

predicate: (x: T, prop?: string) => boolean

Returns

(input: { [key: string]: T; }) => [{ [key: string]: T; }, { [key: string]: T; }]