Options
All
  • Public
  • Public/Protected
  • All
Menu

The Collection is a set of (key, value) entries which can be iterated, and is the base class for all collections in immutable, allowing them to make use of all the Collection methods (such as map and filter).

Note: A collection is always iterated in the same order, however that order may not always be well defined, as is the case for the Map and Set.

Collection is the abstract base class for concrete data structures. It cannot be constructed directly.

Implementations should extend one of the subclasses, Collection.Keyed, Collection.Indexed, or Collection.Set.

Index

Functions

  • Creates a new Collection.Indexed.

    Note: Collection.Indexed is a conversion function and not a class, and does not use the new keyword during construction.

    Type parameters

    • T

    Parameters

    Returns <internal>.Indexed<T>

  • Creates a Collection.Keyed

    Similar to Collection(), however it expects collection-likes of [K, V] tuples if not constructed from a Collection.Keyed or JS Object.

    Note: Collection.Keyed is a conversion function and not a class, and does not use the new keyword during construction.

    Type parameters

    • K

    • V

    Parameters

    Returns <internal>.Collection.Keyed<K, V>

  • Type parameters

    • V

    Parameters

    • obj: {}
      • [key: string]: V

    Returns <internal>.Collection.Keyed<string, V>

  • Similar to Collection(), but always returns a Collection.Set.

    Note: Collection.Set is a factory function and not a class, and does not use the new keyword during construction.

    Type parameters

    • T

    Parameters

    Returns <internal>.Collection.Set<T>

  • deprecated

    use const { isAssociative } = require('immutable')

    Parameters

    • maybeAssociative: unknown

    Returns maybeAssociative is <internal>.Indexed<unknown> | <internal>.Collection.Keyed<unknown, unknown>

  • deprecated

    use const { isIndexed } = require('immutable')

    Parameters

    • maybeIndexed: unknown

    Returns maybeIndexed is <internal>.Indexed<unknown>

  • deprecated

    use const { isKeyed } = require('immutable')

    Parameters

    • maybeKeyed: unknown

    Returns maybeKeyed is <internal>.Collection.Keyed<unknown, unknown>

  • isOrdered(maybeOrdered: unknown): boolean
  • deprecated

    use const { isOrdered } = require('immutable')

    Parameters

    • maybeOrdered: unknown

    Returns boolean

Generated using TypeDoc