MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / sortKeys

Function sortKeys

packages/trigger-sdk/src/io.ts:1557–1574  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

1555
1556function stableStringify(obj: any): string {
1557 function sortKeys(obj: any): any {
1558 if (typeof obj !== "object" || obj === null) {
1559 return obj;
1560 }
1561
1562 if (Array.isArray(obj)) {
1563 return obj.map(sortKeys);
1564 }
1565
1566 const sortedKeys = Object.keys(obj).sort();
1567 const sortedObj: { [key: string]: any } = {};
1568
1569 for (const key of sortedKeys) {
1570 sortedObj[key] = sortKeys(obj[key]);
1571 }
1572
1573 return sortedObj;
1574 }
1575
1576 const sortedObj = sortKeys(obj);
1577 return JSON.stringify(sortedObj);

Callers 1

stableStringifyFunction · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…