* Reset the modified characters from `start` to `end` (of the original string, **not** the generated string).
(start: number, end: number)
| 759 | * Reset the modified characters from `start` to `end` (of the original string, **not** the generated string). |
| 760 | */ |
| 761 | reset(start: number, end: number): this { |
| 762 | start = start + this.offset |
| 763 | end = end + this.offset |
| 764 | |
| 765 | if (this.original.length !== 0) { |
| 766 | while (start < 0) start += this.original.length |
| 767 | while (end < 0) end += this.original.length |
| 768 | } |
| 769 | |
| 770 | if (start === end) |
| 771 | return this |
| 772 | |
| 773 | if (start < 0 || end > this.original.length) |
| 774 | throw new Error('Character is out of bounds') |
| 775 | if (start > end) |
| 776 | throw new Error('end must be greater than start') |
| 777 | |
| 778 | if (DEBUG) |
| 779 | this.stats.time('reset') |
| 780 | |
| 781 | this._split(start) |
| 782 | this._split(end) |
| 783 | |
| 784 | let chunk = this.byStart[start] |
| 785 | |
| 786 | while (chunk) { |
| 787 | chunk.reset() |
| 788 | |
| 789 | chunk = end > chunk.end ? this.byStart[chunk.end] : null |
| 790 | } |
| 791 | |
| 792 | if (DEBUG) |
| 793 | this.stats.timeEnd('reset') |
| 794 | return this |
| 795 | } |
| 796 | |
| 797 | lastChar(): string { |
| 798 | if (this.outro.length) |