Skip to main content
Module

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

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface VariantMapBase.NonEmpty
implements VariantMapBase<K, V, Tp>, [Streamable.NonEmpty]<readonly [K, V]>
import { type VariantMapBase } from "https://deno.land/x/rimbu@0.13.1/collection-types/map-custom/index.ts";
const { NonEmpty } = VariantMapBase;

Properties

readonly
isEmpty: false

Returns false since this collection is known to be non-empty.

Methods

nonEmpty(): true

Returns true since this collection is known to be non-empty

assumeNonEmpty(): this

Returns a self reference since this collection is known to be non-empty.

asNormal(): (Tp & KeyValue<K, V>)["normal"]

Returns this collection typed as a 'possibly empty' collection.

stream(): Stream.NonEmpty<readonly [K, V]>

Returns a non-empty Stream containing all entries of this collection as tuples of key and value.

streamKeys(): Stream.NonEmpty<K>

Returns a non-empty Stream containing all keys of this collection.

streamValues(): Stream.NonEmpty<V>

Returns a non-empty Stream containing all values of this collection.

mapValues<V2>(mapFun: (value: V, key: K) => V2): (Tp & KeyValue<K, V2>)["nonEmpty"]

Returns a non-empty collection with the same keys, but where the given mapFun function is applied to each entry value.

toArray(): ArrayNonEmpty<readonly [K, V]>

Returns a non-empty array containing all entries in this collection.