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

Function create

tests/MagicString/replace-all.test.ts:204–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202 // the insert at 5 leaves the chunk search past the removed range, so the
203 // lookup for a match inside it has to walk backwards to find it
204 const create = () => new MagicString('000----').remove(0, 3).appendLeft(5, '!')
205
206 assert.strictEqual(create().replaceAll('0', '1').toString(), '--!--')
207 assert.strictEqual(create().replaceAll(/0/g, '1').toString(), '--!--')

Callers 1

Calls 2

appendLeftMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected