@hyperframes/lint 0.8.68 → 0.8.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -582,17 +582,17 @@ function mediaSrcTagRe(tagAlternation) {
582
582
 
583
583
  // src/sourceLocations.ts
584
584
  function normalized(source) {
585
- let text = "";
585
+ const chars = [];
586
586
  const offsets = [];
587
+ let lastWasSpace = false;
587
588
  for (let i = 0; i < source.length; i++) {
588
- const char = source[i];
589
- if (/\s/.test(char)) {
590
- if (text.endsWith(" ")) continue;
591
- text += " ";
592
- } else text += char;
589
+ const isSpace = /\s/.test(source[i]);
590
+ if (isSpace && lastWasSpace) continue;
591
+ chars.push(isSpace ? " " : source[i]);
593
592
  offsets.push(i);
593
+ lastWasSpace = isSpace;
594
594
  }
595
- return { text, offsets };
595
+ return { text: chars.join(""), offsets };
596
596
  }
597
597
  function createSourceLocator(source) {
598
598
  const tags = parseHtmlStructure(source).tags;