MCPcopy Create free account
hub / github.com/Faleij/json-stream-stringify / quoteString

Function quoteString

src/JsonStreamStringify.ts:102–111  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

100
101const cache = new Map();
102function quoteString(string: string) {
103 const useCache = string.length < 10_000;
104 // eslint-disable-next-line no-lonely-if
105 if (useCache && cache.has(string)) {
106 return cache.get(string);
107 }
108 const str = primitiveToJSON(String(string));
109 if (useCache) cache.set(string, str);
110 return str;
111}
112
113function readAsPromised(stream: Readable, size?) {
114 const value = stream.read(size);

Callers 2

setItemMethod · 0.85
writeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…