* Appends the specified content at the index in the original string. * If a range *ending* with index is subsequently moved, the insert will be moved with it. * See also `s.prependLeft(...)`.
(index: number, content: string)
| 131 | * See also `s.prependLeft(...)`. |
| 132 | */ |
| 133 | appendLeft(index: number, content: string): this { |
| 134 | index = index + this.offset |
| 135 | |
| 136 | if (typeof content !== 'string') |
| 137 | throw new TypeError('inserted content must be a string') |
| 138 | |
| 139 | if (DEBUG) |
| 140 | this.stats.time('appendLeft') |
| 141 | |
| 142 | this._split(index) |
| 143 | |
| 144 | const chunk = this.byEnd[index] |
| 145 | |
| 146 | if (chunk) { |
| 147 | chunk.appendLeft(content) |
| 148 | } |
| 149 | else { |
| 150 | this.intro += content |
| 151 | } |
| 152 | |
| 153 | if (DEBUG) |
| 154 | this.stats.timeEnd('appendLeft') |
| 155 | return this |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Appends the specified content at the index in the original string. |
no test coverage detected