MCPcopy Create free account
hub / github.com/sveltejs/devalue / stringifyAsync

Function stringifyAsync

src/stringify.js:37–68  ·  view source on GitHub ↗
(value, reducers)

Source from the content-addressed store, hash-verified

35 * @param {Record<string, (value: any) => any>} [reducers]
36 */
37export async function stringifyAsync(value, reducers) {
38 const stringified = run(true, value, reducers);
39
40 if (typeof stringified === 'string') {
41 return stringified;
42 }
43
44 let out = '[';
45
46 for (let i = 0; i < stringified.length; i += 1) {
47 let value = stringified[i];
48
49 if (typeof value !== 'string') {
50 await value;
51 value = stringified[i];
52
53 if (i === 0 && value < 0) {
54 return `${value}`;
55 }
56 }
57
58 out += value;
59
60 if (i < stringified.length - 1) {
61 out += ',';
62 }
63 }
64
65 out += ']';
66
67 return out;
68}
69
70/**
71 * @param {boolean} async

Callers 1

index.test.jsFile · 0.90

Calls 1

runFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…