Add support for translating between character offsets and code point indices #14
Closed
4 tasks done
Labels
🙅 no/wontfix
This is not (enough of) an issue for this project
👎 phase/no
Post cannot or will not be acted on
Initial checklist
Problem
Related: syntax-tree/unist#99.
remark-lint where a user provides a max size of say 80, and they don’t mean the way that JS stores strings.
To check if things are (not) allowed at that point, a lint tool needs to be aware of that difference, and be able to translate between the two.
Solution
Two new methods:
toCodePointIndex(offset: number): number
/fromCodePointIndex(index: number): number
Alternatives
Different utility.
The text was updated successfully, but these errors were encountered: