MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/util/strip-vt-control-characters.js:13–36  ·  view source on GitHub ↗
({ input, n })

Source from the content-addressed store, hash-verified

11});
12
13function main({ input, n }) {
14 let str;
15 switch (input) {
16 case 'noAnsi-short':
17 str = 'This is a plain text string without any ANSI codes';
18 break;
19 case 'noAnsi-long':
20 str = 'Long plain text without ANSI. '.repeat(333);
21 break;
22 case 'ansi-short':
23 str = '\u001B[31mHello\u001B[39m';
24 break;
25 case 'ansi-long':
26 str = ('\u001B[31m' + 'colored text '.repeat(10) + '\u001B[39m').repeat(10);
27 break;
28 }
29
30 bench.start();
31 for (let i = 0; i < n; i++) {
32 const result = stripVTControlCharacters(str);
33 assert.ok(typeof result === 'string');
34 }
35 bench.end(n);
36}

Callers

nothing calls this directly

Calls 4

stripVTControlCharactersFunction · 0.85
startMethod · 0.45
okMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected