@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/browser.js CHANGED
@@ -579,17 +579,17 @@ function truncateSnippet(value, maxLength = 220) {
579
579
 
580
580
  // src/sourceLocations.ts
581
581
  function normalized(source) {
582
- let text = "";
582
+ const chars = [];
583
583
  const offsets = [];
584
+ let lastWasSpace = false;
584
585
  for (let i = 0; i < source.length; i++) {
585
- const char = source[i];
586
- if (/\s/.test(char)) {
587
- if (text.endsWith(" ")) continue;
588
- text += " ";
589
- } else text += char;
586
+ const isSpace = /\s/.test(source[i]);
587
+ if (isSpace && lastWasSpace) continue;
588
+ chars.push(isSpace ? " " : source[i]);
590
589
  offsets.push(i);
590
+ lastWasSpace = isSpace;
591
591
  }
592
- return { text, offsets };
592
+ return { text: chars.join(""), offsets };
593
593
  }
594
594
  function createSourceLocator(source) {
595
595
  const tags = parseHtmlStructure(source).tags;