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

Method snip

src/MagicString.ts:1103–1109  ·  view source on GitHub ↗

* Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.

(start: number, end: number)

Source from the content-addressed store, hash-verified

1101 * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.
1102 */
1103 snip(start: number, end: number): this {
1104 const clone = this.clone()
1105 clone.remove(-clone.offset, start)
1106 clone.remove(end, clone.original.length - clone.offset)
1107
1108 return clone
1109 }
1110
1111 /**
1112 * Applies `offset`, resolves a negative index from the end of `original` as

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.95
removeMethod · 0.45

Tested by

no test coverage detected