• Mutation

    Remark

    only returns undefined if mappingFunction returns undefined

    Example

    Set a Map entry if the key is absent

    const map = new Map([[1, 2]]);
    merge(map)(1, 3, (old, value) => old + value);
    console.log(map); // Map([[1, 5]])

    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, value: V, remappingFunction: ((oldValue: undefined | V, value: V) => undefined | V)) => undefined | V)

      • (key: K, value: V, remappingFunction: ((oldValue: undefined | V, value: V) => undefined | V)): undefined | V
      • Parameters

        • key: K
        • value: V
        • remappingFunction: ((oldValue: undefined | V, value: V) => undefined | V)
            • (oldValue: undefined | V, value: V): undefined | V
            • Parameters

              • oldValue: undefined | V
              • value: V

              Returns undefined | V

        Returns undefined | V

Generated using TypeDoc