* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
(index: number, content: string)
| 696 | * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index |
| 697 | */ |
| 698 | prependLeft(index: number, content: string): this { |
| 699 | index = index + this.offset |
| 700 | |
| 701 | if (typeof content !== 'string') { |
| 702 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 703 | } |
| 704 | |
| 705 | if (DEBUG) |
| 706 | this.stats.time('insertRight') |
| 707 | |
| 708 | this._split(index) |
| 709 | |
| 710 | const chunk = this.byEnd.get(index) |
| 711 | |
| 712 | if (chunk) { |
| 713 | chunk.prependLeft(content) |
| 714 | } |
| 715 | else { |
| 716 | this.intro = content + this.intro |
| 717 | } |
| 718 | |
| 719 | if (DEBUG) |
| 720 | this.stats.timeEnd('insertRight') |
| 721 | return this |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` |