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QAAA,QAAQ,YAInB","sourcesContent":["import { quoteString } from \"./quote\";\nimport { Next, ToString } from \"./types\";\nimport { objectToString } from \"./object\";\nimport { functionToString } from \"./function\";\n\n/**\n * Stringify primitive values.\n */\nconst PRIMITIVE_TYPES: Record<string, ToString> = {\n string: quoteString,\n number: (value: number) => (Object.is(value, -0) ? \"-0\" : String(value)),\n boolean: String,\n symbol: (value: symbol, space: string, next: Next) => {\n const key = Symbol.keyFor(value);\n\n if (key !== undefined) return `Symbol.for(${next(key)})`;\n\n // ES2018 `Symbol.description`.\n return `Symbol(${next((value as any).description)})`;\n },\n bigint: (value: bigint, space: string, next: Next) => {\n return `BigInt(${next(String(value))})`;\n },\n undefined: String,\n object: objectToString,\n function: functionToString,\n};\n\n/**\n * Stringify a value recursively.\n */\nexport const toString: ToString = (value, space, next, key) => {\n if (value === null) return \"null\";\n\n return PRIMITIVE_TYPES[typeof value](value, space, next, key);\n};\n"]}