Function objToMap

  • Converts an object to a Map.

    Type Parameters

    • V

    Parameters

    • obj: Record<ObjectKey, V>

      The object to convert to a Map.

    Returns Map<string, V>

    A new Map object populated with the [key, value] pairs from the original object.

    Remarks

    This function is useful when you need to convert an object to a Map data structure.

    Typeparam

    V - The type of the values in the object.

    Example

    const obj = { key1: 'value1', key2: 'value2' };
    const map = objToMap(obj);
    map.get('key1');
    //=> 'value1'
    map.get('key2');
    //=> 'value2'

Generated using TypeDoc