Skip to content

Add support for translating between character offsets and code point indices #14

Open
@wooorm

Description

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.

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions