{"version":3,"file":"MapExtensions.js","sourceRoot":"","sources":["../src/MapExtensions.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;GAIG;AACH,MAAa,aAAa;IACxB;;;;;;OAMG;IACI,MAAM,CAAC,YAAY,CAAO,SAAoB,EAAE,SAA4B;QACjF,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE;YACtC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,QAAQ,CAAS,GAAwB;QACrD,MAAM,MAAM,GAA8B,EAAE,CAAC;QAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACrB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5BD,sCA4BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Helper functions for working with the `Map` data type.\n *\n * @public\n */\nexport class MapExtensions {\n /**\n * Adds all the (key, value) pairs from the source map into the target map.\n * @remarks\n * This function modifies targetMap. Any existing keys will be overwritten.\n * @param targetMap - The map that entries will be added to\n * @param sourceMap - The map containing the entries to be added\n */\n public static mergeFromMap(targetMap: Map, sourceMap: ReadonlyMap): void {\n for (const pair of sourceMap.entries()) {\n targetMap.set(pair[0], pair[1]);\n }\n }\n\n /**\n * Converts a string-keyed map to an object.\n * @remarks\n * This function has the same effect as Object.fromEntries(map.entries())\n * in supported versions of Node (\\>= 12.0.0).\n * @param map - The map that the object properties will be sourced from\n */\n public static toObject(map: Map): { [key: string]: TValue } {\n const object: { [key: string]: TValue } = {};\n for (const [key, value] of map.entries()) {\n object[key] = value;\n }\n return object;\n }\n}\n"]}