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