* Appends the specified content at the index in the original string. * If a range *starting* with index is subsequently moved, the insert will be moved with it. * See also `s.prependRight(...)`.
(index: number, content: string)
| 161 | * See also `s.prependRight(...)`. |
| 162 | */ |
| 163 | appendRight(index: number, content: string): this { |
| 164 | index = index + this.offset |
| 165 | |
| 166 | if (typeof content !== 'string') { |
| 167 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 168 | } |
| 169 | |
| 170 | if (DEBUG) |
| 171 | this.stats.time('appendRight') |
| 172 | |
| 173 | this._split(index) |
| 174 | |
| 175 | const chunk = this.byStart.get(index) |
| 176 | |
| 177 | if (chunk) { |
| 178 | chunk.appendRight(content) |
| 179 | } |
| 180 | else { |
| 181 | this.outro += content |
| 182 | } |
| 183 | |
| 184 | if (DEBUG) |
| 185 | this.stats.timeEnd('appendRight') |
| 186 | return this |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Does what you'd expect. |