MCPcopy
hub / github.com/webpack/webpack / tokenRoundtrip

Function tokenRoundtrip

test/walkCssTokens.unittest.js:116–129  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

114 * @returns {string} input reconstructed from token source slices
115 */
116const tokenRoundtrip = (input) => {
117 let out = "";
118 for (let pos = 0; ; ) {
119 const t = readToken(
120 input,
121 pos,
122 /** @type {import("../lib/css/syntax").MutableToken} */ ({})
123 );
124 if (t === undefined) break;
125 pos = t.end;
126 out += input.slice(t.start, t.end);
127 }
128 return out;
129};
130
131// Regressions from the css-parsing-tests corpus: each input previously hung
132// the parser or dropped bytes from the token stream.

Callers 1

Calls 2

readTokenFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected