Class Options<T>

Improve Map by adding a merge feature and optional compile-time key/value typing.

Type Parameters

  • T extends OptionsObject = OptionsObject

    Shape of the options object. When omitted the class behaves like the original untyped Options.

Hierarchy

  • Map
    • Options

Constructors

Properties

size: number

Returns

the number of elements in the Map.

[toStringTag]: string
[species]: MapConstructor

Methods

  • Returns void

  • Parameters

    • key: any

    Returns boolean

    true if an element in the Map existed and has been removed, or false if the element does not exist.

  • Executes a provided function once per each key/value pair in the Map, in insertion order.

    Parameters

    • callbackfn: ((value, key, map) => void)
        • (value, key, map): void
        • Parameters

          • value: any
          • key: any
          • map: Map<any, any>

          Returns void

    • Optional thisArg: any

    Returns void

  • Parameters

    • key: any

    Returns boolean

    boolean indicating whether an element with the specified key exists or not.

  • Returns an iterable of entries in the map.

    Returns IterableIterator<[any, any]>

  • Returns an iterable of key, value pairs for every entry in the map.

    Returns IterableIterator<[any, any]>

  • Returns an iterable of keys in the map

    Returns IterableIterator<any>

  • Returns an iterable of values in the map

    Returns IterableIterator<any>

  • Retrieve a typed value by key.

    Type Parameters

    • K extends string

    Parameters

    • key: K

    Returns T[K]

  • Store a typed value by key.

    Type Parameters

    • K extends string

    Parameters

    • key: K
    • value: T[K]

    Returns this