Home > @rushstack/node-core-library > MapExtensions > toObject

MapExtensions.toObject() method

Converts a string-keyed map to an object.

Signature:

static toObject<TValue>(map: Map<string, TValue>): {
        [key: string]: TValue;
    };

Parameters

Parameter Type Description
map Map<string, TValue> The map that the object properties will be sourced from

Returns:

{ [key: string]: TValue; }

Remarks

This function has the same effect as Object.fromEntries(map.entries()) in supported versions of Node (>= 12.0.0).