(data)
| 23 | * @returns {Promise<SizeInfo>} size info |
| 24 | */ |
| 25 | const captureSize = async (data) => { |
| 26 | let size = 0; |
| 27 | let lazySize = 0; |
| 28 | for (const b of data) { |
| 29 | if (Buffer.isBuffer(b)) { |
| 30 | size += b.length; |
| 31 | } else if (typeof b === "function") { |
| 32 | const i = lazySizes.length; |
| 33 | lazySizes.push(undefined); |
| 34 | const r = await captureSize(await b()); |
| 35 | lazySize += r.size + r.lazySize; |
| 36 | lazySizes[i] = r; |
| 37 | } |
| 38 | } |
| 39 | return { size, lazySize }; |
| 40 | }; |
| 41 | |
| 42 | const ESCAPE = null; |
| 43 | const ESCAPE_ESCAPE_VALUE = null; |
no test coverage detected