MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / _hasRemovedContent

Method _hasRemovedContent

src/MagicString.ts:1425–1433  ·  view source on GitHub ↗

* Whether the original range [start, end) has had any of its characters * removed. `replace`/`replaceAll` search `original`, so a match can land on * text that is no longer in the output - overwriting it would resurrect the * removed characters, so such matches are skipped instead. *

(start: number, end: number)

Source from the content-addressed store, hash-verified

1423 * @internal
1424 */
1425 _hasRemovedContent(start: number, end: number): boolean {
1426 let chunk: Chunk | null = this.firstChunk
1427 while (chunk) {
1428 if (chunk.content === '' && chunk.start < end && chunk.end > start)
1429 return true
1430 chunk = chunk.next
1431 }
1432 return false
1433 }
1434
1435 /** @internal */
1436 _replaceRegexp(searchValue: RegExp, replacement: string | ReplacementFunction): this {

Callers 3

replaceMatchMethod · 0.95
_replaceStringMethod · 0.95
_replaceAllStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected