Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/TransformableString.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function locationToIndex(location, lineStarts) {
}

function indexToLocation(index, lineStarts) {
if (index < 0) throw new Error("Invalid index")
if (index < 0) return

let line = 0
while (line + 1 < lineStarts.length && lineStarts[line + 1] <= index) {
Expand Down Expand Up @@ -106,7 +106,7 @@ module.exports = class TransformableString {
}
}
if (index < 0 || index > this._original.length) {
throw new Error("Invalid index")
return
}
if (index == this._original.length) {
if (block.to && block.to === this._original.length) {
Expand Down