* Applies `offset`, resolves a negative index from the end of `original` as * `update`/`remove` always have, and rejects anything that is not an integer. * Bounds are checked by the caller, because the methods report them differently. * * @internal
(index: number)
| 1116 | * @internal |
| 1117 | */ |
| 1118 | _resolveIndex(index: number): number { |
| 1119 | const resolved = index + this.offset |
| 1120 | if (!Number.isInteger(resolved)) { |
| 1121 | throw new MagicStringError(`index must be an integer, got ${index}`) |
| 1122 | } |
| 1123 | if (resolved < 0 && this.original.length !== 0) { |
| 1124 | return Math.max(0, resolved + this.original.length) |
| 1125 | } |
| 1126 | return resolved |
| 1127 | } |
| 1128 | |
| 1129 | /** |
| 1130 | * The chunk whose original range holds `index` (`chunk.start <= index < chunk.end`), |
no outgoing calls
no test coverage detected