• Mutation

    Remark

    only returns undefined if mappingFunction returns undefined

    Example

    Compute the new value based on the old Map entry

    const map = new Map();
    compute(map)(1, (key, value) => value ?? 2);
    console.log(map); // Map([[1, 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 (<T>(key: K, remappingFunction: ((key: K, value: T) => undefined | V)) => undefined | V)

      • <T>(key: K, remappingFunction: ((key: K, value: T) => undefined | V)): undefined | V
      • Type Parameters

        • T

        Parameters

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

              • key: K
              • value: T

              Returns undefined | V

        Returns undefined | V

Generated using TypeDoc