Closed mysteryven closed 3 months ago
When using a negative index to remove, it will cause infinite loop.
const magicString = require('magic-string'); let s = "" let ms = new magicString(s); ms.remove(-2, -1); console.log(map);
https://stackblitz.com/edit/stackblitz-starters-qxzkza?file=index.js
To reproduce it, run node index.js in the terminal.
node index.js
it should throw error: Character is out of bounds
Would you like to send a quick PR? Thanks!
Description
When using a negative index to remove, it will cause infinite loop.
https://stackblitz.com/edit/stackblitz-starters-qxzkza?file=index.js
To reproduce it, run
node index.js
in the terminal.Expect behaviour
it should throw error: Character is out of bounds