* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
(index: number, content: string)
| 809 | * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index |
| 810 | */ |
| 811 | prependLeft(index: number, content: string): this { |
| 812 | index = index + this.offset |
| 813 | |
| 814 | if (typeof content !== 'string') { |
| 815 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 816 | } |
| 817 | |
| 818 | if (DEBUG) |
| 819 | this.stats.time('insertRight') |
| 820 | |
| 821 | this._split(index) |
| 822 | |
| 823 | const chunk = this.byEnd.get(index) |
| 824 | |
| 825 | if (chunk) { |
| 826 | chunk.prependLeft(content) |
| 827 | } |
| 828 | else { |
| 829 | this.intro = content + this.intro |
| 830 | } |
| 831 | |
| 832 | if (DEBUG) |
| 833 | this.stats.timeEnd('insertRight') |
| 834 | return this |
| 835 | } |
| 836 | |
| 837 | /** |
| 838 | * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` |