* 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 TypeError('inserted content must be a string') |
| 168 | |
| 169 | if (DEBUG) |
| 170 | this.stats.time('appendRight') |
| 171 | |
| 172 | this._split(index) |
| 173 | |
| 174 | const chunk = this.byStart[index] |
| 175 | |
| 176 | if (chunk) { |
| 177 | chunk.appendRight(content) |
| 178 | } |
| 179 | else { |
| 180 | this.outro += content |
| 181 | } |
| 182 | |
| 183 | if (DEBUG) |
| 184 | this.stats.timeEnd('appendRight') |
| 185 | return this |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Does what you'd expect. |