* Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
(index: number, content: string)
| 912 | * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` |
| 913 | */ |
| 914 | prependRight(index: number, content: string): this { |
| 915 | index = index + this.offset |
| 916 | |
| 917 | if (typeof content !== 'string') { |
| 918 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 919 | } |
| 920 | |
| 921 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 922 | if (DEBUG) |
| 923 | this.stats.time('insertRight') |
| 924 | |
| 925 | this._split(index) |
| 926 | |
| 927 | const chunk = this.byStart.get(index) |
| 928 | |
| 929 | if (chunk) { |
| 930 | chunk.prependRight(content) |
| 931 | } |
| 932 | else { |
| 933 | this.outro = content + this.outro |
| 934 | } |
| 935 | |
| 936 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 937 | if (DEBUG) |
| 938 | this.stats.timeEnd('insertRight') |
| 939 | return this |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * Removes the characters from `start` to `end` (of the original string, **not** the generated string). |
no test coverage detected