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

x/revoltio/src/util/mod.ts>Collection.combineEntries

No-nonsense Revolt library for nodejs and deno.
Latest
method Collection.combineEntries
import { Collection } from "https://deno.land/x/revoltio@v1.0.0/src/util/mod.ts";

Creates a Collection from a list of entries.

Examples

Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); // returns Collection { "a" => 3, "b" => 2 }

Parameters

entries: Iterable<[K, V]>

The list of entries

combine: (
firstValue: V,
secondValue: V,
key: K,
) => V

Function to combine an existing entry with a new one