MCPcopy Index your code
hub / github.com/MALSync/MALSync / objectToString

Function objectToString

src/pages-chibi/builder/chibiHelper.ts:26–44  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

24}
25
26function objectToString(obj: any): string {
27 const result = {};
28
29 Object.keys(obj)
30 .sort()
31 .forEach(key => {
32 const value = obj[key];
33 if (typeof value === 'function') {
34 const fnStr = value.toString().replace(/\r\n/g, '\n').replace(/\s+/g, ' ').trim();
35 result[key] = fnStr;
36 } else if (typeof value === 'object' && value !== null) {
37 result[key] = objectToString(value);
38 } else {
39 result[key] = value;
40 }
41 });
42
43 return JSON.stringify(result);
44}
45
46function createShortHash(str: string): string {
47 let hash = 0;

Callers 1

getVersionHashesFunction · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected