MCPcopy Index your code
hub / github.com/nodejs/node / buildContent

Function buildContent

benchmark/util/text-decoder.js:15–25  ·  view source on GitHub ↗
(content, len)

Source from the content-addressed store, hash-verified

13});
14
15function buildContent(content, len) {
16 let base;
17 switch (content) {
18 case 'ascii': base = 'a'; break;
19 case 'one-byte-string': base = '\xff'; break;
20 case 'two-byte-string': base = 'ğ'; break;
21 }
22 const unitBytes = Buffer.byteLength(base, 'utf8');
23 const copies = Math.max(1, Math.floor(len / unitBytes));
24 return Buffer.from(base.repeat(copies));
25}
26
27function main({ encoding, len, n, ignoreBOM, type, fatal, content }) {
28 const decoder = new TextDecoder(encoding, { ignoreBOM, fatal });

Callers 1

mainFunction · 0.70

Calls 2

maxMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…