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

x/denocordts/deps.ts>Collection#reduce

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

Applies a function to produce a single value. Identical in behavior to Array.reduce().

Examples

collection.reduce((acc, guild) => acc + guild.memberCount, 0);

Parameters

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

Function used to reduce, taking four arguments; accumulator, currentValue, currentKey, and collection

optional
initialValue: T