(text: string, offset: number)
| 49 | * @returns [start, end] |
| 50 | */ |
| 51 | export const getCharRange = (text: string, offset: number) => { |
| 52 | let i = 0 |
| 53 | for (; i <= offset; ) { |
| 54 | const end = i + getCharOffsetForward(text, i) |
| 55 | if (end > offset) return [i, end] |
| 56 | i = end |
| 57 | } |
| 58 | return [i, i + Math.min(text.length, 1)] |
| 59 | } |
| 60 | |
| 61 | const isSpace = (char: string) => /\s/.test(char) |
| 62 | // http://www.unicode.org/charts/ |
no test coverage detected
searching dependent graphs…