MCPcopy Index your code
hub / github.com/subquery/subql / handledStringify

Function handledStringify

packages/node-core/src/utils/string.ts:29–43  ·  view source on GitHub ↗
(obj: any, depth = 0)

Source from the content-addressed store, hash-verified

27}
28
29export function handledStringify(obj: any, depth = 0): string {
30 try {
31 if (depth > 0) {
32 const limitedObj = truncateObject(obj, 0, depth);
33 return JSON.stringify(limitedObj);
34 }
35
36 return JSON.stringify(obj);
37 } catch (error) {
38 if (error instanceof Error) {
39 return error.stack || error.message;
40 }
41 return 'Unknown error when Stringify';
42 }
43}

Callers 11

string.spec.tsFile · 0.90
indexDataFunction · 0.90
getMethod · 0.90
getByFieldMethod · 0.90
getByFieldsMethod · 0.90
getOneByFieldMethod · 0.90
setMethod · 0.90
bulkCreateMethod · 0.90
bulkUpdateMethod · 0.90
bulkRemoveMethod · 0.90

Calls 1

truncateObjectFunction · 0.85

Tested by

no test coverage detected