* Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
(index: number, content: string)
| 855 | * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` |
| 856 | */ |
| 857 | prependRight(index: number, content: string): this { |
| 858 | index = index + this.offset |
| 859 | |
| 860 | if (typeof content !== 'string') { |
| 861 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 862 | } |
| 863 | |
| 864 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 865 | if (DEBUG) |
| 866 | this.stats.time('insertRight') |
| 867 | |
| 868 | this._split(index) |
| 869 | |
| 870 | const chunk = this.byStart.get(index) |
| 871 | |
| 872 | if (chunk) { |
| 873 | chunk.prependRight(content) |
| 874 | } |
| 875 | else { |
| 876 | this.outro = content + this.outro |
| 877 | } |
| 878 | |
| 879 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 880 | if (DEBUG) |
| 881 | this.stats.timeEnd('insertRight') |
| 882 | return this |
| 883 | } |
| 884 | |
| 885 | /** |
| 886 | * Removes the characters from `start` to `end` (of the original string, **not** the generated string). |
no test coverage detected