(string: string)
| 100 | |
| 101 | const cache = new Map(); |
| 102 | function 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 | |
| 113 | function readAsPromised(stream: Readable, size?) { |
| 114 | const value = stream.read(size); |