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