MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / expandTabs

Function expandTabs

lib/utils.ts:87–95  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

85}
86
87export function expandTabs(line: string): string {
88 let extraChars = 0;
89 return line.replaceAll(tabsRe, (match, offset) => {
90 const total = offset + extraChars;
91 const spacesNeeded = (total + 8) & 7;
92 extraChars += spacesNeeded - 1;
93 return ' '.substring(spacesNeeded);
94 });
95}
96
97function getRegexForTempdir(): RegExp {
98 const tmp = os.tmpdir();

Callers

nothing calls this directly

Calls 1

replaceAllMethod · 0.80

Tested by

no test coverage detected