/**
 * Converts a Map to a plain JavaScript object.
 *
 * This is useful for serializing a Map to JSON or passing it through data formats
 * that do not support Map.
 *
 * @template K - The type of keys in the Map.
 * @template V - The type of values in the Map.
 * @param {Map<K, V>} map - The Map to convert to a plain JavaScript object.
 * @returns {Record<string, V>} - A plain JavaScript object where each key-value pair
 *                                from the Map is represented as a string key and its
 *                                corresponding value.
 *
 * @example
 * // Define a type for the map keys
 * type KeyType = [string, string];
 *
 * // Define a type for the map values
 * interface ValueType {
 *   statusIndicator?: any; // Simplified for example
 * }
 *
 * // Create a new map
 * const key: KeyType = ["teamId", "anotherId"];
 * const value: ValueType = {
 *   statusIndicator: {
 *     isVisible: true,
 *     backgroundColor: '#ff0000'
 *   }
 * };
 *
 * const customMappingToStyleOverrides = new Map<KeyType, ValueType>([
 *   [key, value]
 * ]);
 *
 * // Convert the map to an object
 * const result = mapToObject(customMappingToStyleOverrides);
 *
 * // Log the result
 * console.log(JSON.stringify(result, null, 2));
 */
export function mapToObject<K, V>(map: Map<K, V>): Record<string, V> {
    const obj: Record<string, V> = {};
    map.forEach((value, key) => {
      // Assuming key can be converted to string
      obj[JSON.stringify(key)] = value;
    });
    return obj;
  }