* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
(index: number, content: string)
| 670 | * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index |
| 671 | */ |
| 672 | prependLeft(index: number, content: string): this { |
| 673 | index = index + this.offset |
| 674 | |
| 675 | if (typeof content !== 'string') { |
| 676 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 677 | } |
| 678 | |
| 679 | if (DEBUG) |
| 680 | this.stats.time('insertRight') |
| 681 | |
| 682 | this._split(index) |
| 683 | |
| 684 | const chunk = this.byEnd.get(index) |
| 685 | |
| 686 | if (chunk) { |
| 687 | chunk.prependLeft(content) |
| 688 | } |
| 689 | else { |
| 690 | this.intro = content + this.intro |
| 691 | } |
| 692 | |
| 693 | if (DEBUG) |
| 694 | this.stats.timeEnd('insertRight') |
| 695 | return this |
| 696 | } |
| 697 | |
| 698 | /** |
| 699 | * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` |