MCPcopy Create free account
hub / github.com/ionic-team/capacitor / formatJSObject

Function formatJSObject

cli/src/util/js.ts:3–17  ·  view source on GitHub ↗
(o: { [key: string]: any })

Source from the content-addressed store, hash-verified

1import util from 'util';
2
3export function formatJSObject(o: { [key: string]: any }): string {
4 try {
5 o = JSON.parse(JSON.stringify(o));
6 } catch (e: any) {
7 throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}`);
8 }
9
10 return util.inspect(o, {
11 compact: false,
12 breakLength: Infinity,
13 depth: Infinity,
14 maxArrayLength: Infinity,
15 maxStringLength: Infinity,
16 });
17}

Callers 1

formatConfigTSFunction · 0.90

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected