* 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)
| 255 | * See also `s.prependRight(...)`. |
| 256 | */ |
| 257 | appendRight(index: number, content: string): this { |
| 258 | index = index + this.offset |
| 259 | |
| 260 | if (typeof content !== 'string') { |
| 261 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 262 | } |
| 263 | |
| 264 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 265 | if (DEBUG) |
| 266 | this.stats.time('appendRight') |
| 267 | |
| 268 | this._split(index) |
| 269 | |
| 270 | const chunk = this.byStart.get(index) |
| 271 | |
| 272 | if (chunk) { |
| 273 | chunk.appendRight(content) |
| 274 | } |
| 275 | else { |
| 276 | this.outro += content |
| 277 | } |
| 278 | |
| 279 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 280 | if (DEBUG) |
| 281 | this.stats.timeEnd('appendRight') |
| 282 | return this |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Does what you'd expect. |
no test coverage detected