• Example

    Get a value from a Map or the defaultValue if the key is absent

    const map = new Map();
    const value = getOrDefault(map)(1, 2);
    console.log(value); // 2

    Type Parameters

    • K

      the Map key type

    • V

      the Map value type

    Parameters

    • map: Map<K, V>

      the Map to set the entry

    Returns ((key: K, defaultValue: V) => V)

      • (key: K, defaultValue: V): V
      • Parameters

        • key: K
        • defaultValue: V

        Returns V

Generated using TypeDoc