MCPcopy Create free account
hub / github.com/rollup/plugins / stringify

Function stringify

packages/pluginutils/src/dataToEsm.ts:7–12  ·  view source on GitHub ↗
(obj: unknown)

Source from the content-addressed store, hash-verified

5export type Indent = string | null | undefined;
6
7function stringify(obj: unknown): string {
8 return (JSON.stringify(obj) || 'undefined').replace(
9 /[\u2028\u2029]/g,
10 (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`
11 );
12}
13
14function serializeArray<T>(arr: T[], indent: Indent, baseIndent: string): string {
15 let output = '[';

Callers 3

serializeObjectFunction · 0.85
serializeFunction · 0.85
dataToEsmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected