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

x/rimbu/multiset/custom/index.ts>MultiSetBase.Factory

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Latest
interface MultiSetBase.Factory
import { type MultiSetBase } from "https://deno.land/x/rimbu@1.2.1/multiset/custom/index.ts";
const { Factory } = MultiSetBase;

Type Parameters

optional
UT = unknown

Methods

empty<T extends UT>(): WithElem<Tp, T>["normal"]

Returns the (singleton) empty instance of this type and context with given key and value types.

of<T extends UT>(...values: ArrayNonEmpty<T>): WithElem<Tp, T>["nonEmpty"]

Returns an immutable multimap of this collection type and context, containing the given values.

from<T extends UT>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<T>>): WithElem<Tp, T>["nonEmpty"]

Returns an immutable multimap of this type and context, containing the values in the given sources StreamSource.

from<T extends UT>(...sources: ArrayNonEmpty<StreamSource<T>>): WithElem<Tp, T>["normal"]
builder<T extends UT>(): WithElem<Tp, T>["builder"]

Returns an empty builder instance for this type of collection and context.

reducer<T extends UT>(source?: StreamSource<T>): Reducer<T, WithElem<Tp, T>["normal"]>

Returns a Reducer that appends received items to a MultiSet and returns the MultiSet as a result. When a source is given, the reducer will first create a MultiSet from the source, and then add elements to it.