* 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)
| 247 | * See also `s.prependRight(...)`. |
| 248 | */ |
| 249 | appendRight(index: number, content: string): this { |
| 250 | index = this._resolveIndex(index) |
| 251 | if (index < 0 || index > this.original.length) { |
| 252 | throw new MagicStringError(`index ${index} is out of bounds`) |
| 253 | } |
| 254 | |
| 255 | if (typeof content !== 'string') { |
| 256 | throw new MagicStringError(`content must be a string, got ${typeof content}`) |
| 257 | } |
| 258 | |
| 259 | this._split(index) |
| 260 | |
| 261 | const chunk = this.byStart.get(index) |
| 262 | |
| 263 | if (chunk) { |
| 264 | chunk.appendRight(content) |
| 265 | } |
| 266 | else { |
| 267 | this.outro += content |
| 268 | } |
| 269 | |
| 270 | return this |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Returns an independent copy: the chunk list, string-level intro/outro, |
no test coverage detected