Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/denocordts/deps.ts>Collection#find

An Object Oriented Discord API wrapper for Deno.
Latest
method Collection.prototype.find
import { Collection } from "https://deno.land/x/denocordts@1.2.0/deps.ts";

Searches for a single item where the given function returns a truthy value. This behaves like Array.find(). All collections used in Discord.js are mapped using their id property, and if you want to find by id you should use the get method. See MDN for details.

Examples

collection.find(user => user.username === 'Bob');

Parameters

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

The function to test with (should return boolean)

Returns

V | undefined

Parameters

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

Returns

V | undefined