MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / removeRanges

Function removeRanges

scripts/experimental/swiftui-preview.mjs:1012–1021  ·  view source on GitHub ↗
(source, ranges)

Source from the content-addressed store, hash-verified

1010}
1011
1012function removeRanges(source, ranges) {
1013 let output = "";
1014 let cursor = 0;
1015 for (const [start, end] of ranges.sort((a, b) => a[0] - b[0])) {
1016 output += source.slice(cursor, start);
1017 cursor = end;
1018 }
1019 output += source.slice(cursor);
1020 return output;
1021}
1022
1023function sanitizePreviewSource(source, moduleName) {
1024 const stripped = source.replace(

Callers 1

reloadPreviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected