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

x/revoltio/deps.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/deps.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