(text: string, offset: number)
| 221 | } |
| 222 | |
| 223 | export function offsetToPosition(text: string, offset: number) { |
| 224 | const stringOffset = utf8ByteOffsetToStringIndex(text, offset) |
| 225 | return offsetsToSelection(text, stringOffset, stringOffset).start |
| 226 | } |
| 227 | |
| 228 | function utf8ByteOffsetToStringIndex(text: string, byteOffset: number) { |
| 229 | if (byteOffset <= 0) return 0 |
no test coverage detected