Skip to main content
Module

x/rimbu/collection-types/map-custom/index.ts>RMapBase

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
namespace RMapBase
import { RMapBase } from "https://deno.land/x/rimbu@0.13.1/collection-types/map-custom/index.ts";

Interfaces

The map's Context instance that serves as a factory for all related immutable instances and builders.

Utility interface that provides higher-kinded types for this collection.

interface RMapBase
implements VariantMapBase<K, V, Tp>
import { type RMapBase } from "https://deno.land/x/rimbu@0.13.1/collection-types/map-custom/index.ts";

Properties

readonly
context: WithKeyValue<Tp, K, V>["context"]

Returns the context associated to this collection instance.

Methods

set(key: K, value: V): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the given key associated to the given value.

addEntry(entry: readonly [K, V]): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with given entry added.

addEntries<V2 extends V = V>(entries: StreamSource.NonEmpty<readonly [K, V2]>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the entries from the given StreamSource entries added.

addEntries<V2 extends V = V>(entries: StreamSource<readonly [K, V2]>): WithKeyValue<Tp, K, V>["normal"]
modifyAt(atKey: K, options: { ifNew?: OptLazyOr<V, Token>; ifExists?: <V2 extends V = V>(currentEntry: V & V2, remove: Token) => V | Token; }): WithKeyValue<Tp, K, V>["normal"]

Returns the collection with the given atKey key modified according to given options.

updateAt<UK = K>(key: RelatedTo<K, UK>, update: RMapBase.Update<V>): WithKeyValue<Tp, K, V>["normal"]

Returns the collection where the value associated with given key is updated with the given update value or update function.

toBuilder(): WithKeyValue<Tp, K, V>["builder"]

Returns a builder object containing the entries of this collection.