Skip to content

Commit

Permalink
Refactor to improve performance w/ push, reverse
Browse files Browse the repository at this point in the history
Closes GH-170.
  • Loading branch information
robsimmons committed Mar 27, 2024
1 parent 2edb5e7 commit 15a609e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/micromark-util-subtokenize/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ function subcontent(events, eventIndex) {
const slice = childEvents.slice(breaks[index], breaks[index + 1])
const start = startPositions.pop()
assert(start !== undefined, 'expected a start position when splicing')
jumps.unshift([start, start + slice.length - 1])
jumps.push([start, start + slice.length - 1])
splice(events, start, 2, slice)
}

jumps.reverse()
index = -1

while (++index < jumps.length) {
Expand Down

0 comments on commit 15a609e

Please sign in to comment.