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

Function serializeArray

packages/pluginutils/src/dataToEsm.ts:14–22  ·  view source on GitHub ↗
(arr: T[], indent: Indent, baseIndent: string)

Source from the content-addressed store, hash-verified

12}
13
14function serializeArray<T>(arr: T[], indent: Indent, baseIndent: string): string {
15 let output = '[';
16 const separator = indent ? `\n${baseIndent}${indent}` : '';
17 for (let i = 0; i < arr.length; i++) {
18 const key = arr[i];
19 output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
20 }
21 return `${output}${indent ? `\n${baseIndent}` : ''}]`;
22}
23
24function serializeObject(obj: object, indent: Indent, baseIndent: string): string {
25 let output = '{';

Callers 1

serializeFunction · 0.85

Calls 1

serializeFunction · 0.85

Tested by

no test coverage detected