• Copies all entries of a Map into a new Map

    Example

    Copy a Map

    const map = new Map([["A", "B"]]);
    const copiedMap = copy(map);
    console.log(copiedMap); // Map([["A", "B"]])
    console.log(map === copiedMap); // false

    Returns

    the new Map containing all entries of the source Map

    Type Parameters

    • K

      the Map key type

    • V

      the Map value type

    Parameters

    • map: Map<K, V>

      the Map to copy

    Returns Map<K, V>

Generated using TypeDoc