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

Function writeGroup

lib/internal/util/inspect.js:556–576  ·  view source on GitHub ↗
(start, end, decreaseDepth = 1)

Source from the content-addressed store, hash-verified

554 }, []);
555
556 function writeGroup(start, end, decreaseDepth = 1) {
557 let seq = '';
558 i++;
559 // Only checking for the closing delimiter is a fast heuristic for regular
560 // expressions without the u or v flag. A safer check would verify that the
561 // read characters are all alphanumeric.
562 while (i < regexpString.length && regexpString[i] !== end) {
563 seq += regexpString[i++];
564 }
565 if (i < regexpString.length) {
566 depth -= decreaseDepth;
567 write(start);
568 writeDepth(seq, 1, 1);
569 write(end);
570 depth += decreaseDepth;
571 } else {
572 // The group is not closed which would lead to mistakes in the output.
573 // This is a workaround to prevent output from being corrupted.
574 writeDepth(start, 1, -seq.length);
575 }
576 }
577
578 const write = (str) => {
579 const idx = depth % palette.length;

Callers 1

highlightRegExpFunction · 0.85

Calls 2

writeDepthFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…