Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/collection/src/Collection.ts>default#partition

Utility data structure for Deno (Discord.js Collection).
Latest
method default.prototype.partition
import { default } from "https://deno.land/x/collection@v1.0.1/src/Collection.ts";

Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.

Examples

const [big, small] = collection.partition(guild => guild.memberCount > 250);

Parameters

fn: (
value: V,
key: K,
collection: this,
) => boolean

Function used to test (should return a boolean)

Returns

[this, this]

Parameters

fn: (
this: T,
value: V,
key: K,
collection: this,
) => boolean
thisArg: T

Returns

[this, this]