Class IterableEntryBase<K, V>Abstract

Iterable view over key-value entries.

Time O(1), Space O(1)

Type Parameters

  • K = any

    Key type.

  • V = any

    Value type.

Hierarchy (view full)

Accessors

Methods

  • Underlying iterator for the default iteration protocol.

    Parameters

    • Rest...args: any[]

    Returns IterableIterator<[K, V], any, any>

    Iterator of [K, V].

    Time O(n), Space O(1)

  • Default iterator yielding [key, value] entries.

    Parameters

    • Rest...args: any[]

    Returns IterableIterator<[K, V], any, any>

    Iterator of [K, V].

    Time O(n) to iterate, Space O(1)

  • Iterate over [key, value] pairs (may yield undefined values).

    Returns IterableIterator<[K, undefined | V], any, any>

    Iterator of [K, V | undefined].

    Time O(n), Space O(1)

  • Test whether all entries satisfy the predicate.

    Parameters

    • predicate: EntryCallback<K, V, boolean>

      (key, value, index, self) => boolean.

    • OptionalthisArg: any

      Optional this for callback.

    Returns boolean

    true if all pass; otherwise false.

    Time O(n), Space O(1)

  • Filter entries and return the same-species structure.

    Parameters

    • Rest...args: any[]

    Returns this

    A new instance of the same concrete class (this type).

    Time O(n), Space O(n)

  • Find the first entry that matches a predicate.

    Parameters

    • callbackfn: EntryCallback<K, V, boolean>

      (key, value, index, self) => boolean.

    • OptionalthisArg: any

      Optional this for callback.

    Returns undefined | [K, V]

    Matching [key, value] or undefined.

    Time O(n), Space O(1)

  • Visit each entry, left-to-right.

    Parameters

    • callbackfn: EntryCallback<K, V, void>

      (key, value, index, self) => void.

    • OptionalthisArg: any

      Optional this for callback.

    Returns void

    Time O(n), Space O(1)

  • Whether there exists an entry with the given value.

    Parameters

    • value: V

      Value to test.

    Returns boolean

    true if found; otherwise false.

    Time O(n), Space O(1)

  • Reduce entries into a single accumulator.

    Type Parameters

    • U

    Parameters

    • callbackfn: ReduceEntryCallback<K, V, U>

      (acc, value, key, index, self) => acc.

    • initialValue: U

      Initial accumulator.

    Returns U

    Final accumulator.

    Time O(n), Space O(1)

  • Test whether any entry satisfies the predicate.

    Parameters

    • predicate: EntryCallback<K, V, boolean>

      (key, value, index, self) => boolean.

    • OptionalthisArg: any

      Optional this for callback.

    Returns boolean

    true if any passes; otherwise false.

    Time O(n), Space O(1)

  • Visualize the iterable as an array of [key, value] pairs (or a custom string).

    Returns string | [K, V][]

    Array of entries (default) or a string.

    Time O(n), Space O(n)