• Gets the value on map for the given key if it exists, otherwise sets [key] to defaultValue, returning the newly set value.

    Type Parameters

    • K
    • V

    Parameters

    • map: Map<K, V>
    • key: K
    • defaultValue: ((key: K) => V)
        • (key): V
        • Parameters

          • key: K

          Returns V

    Returns V