You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tiny but useful package to convert between arbitrary places in a
file.
When should I use this?
This utility is useful when ASTs nodes don’t cut it.
For example, when you are making a lint rule that looks for dangerous
characters in a file, which you accomplish by searching the raw file value,
and still want to report it to users.
Install
This package is ESM only.
In Node.js (version 16+), install with npm:
toOffset ((point?: PointLike | null | undefined) => number | undefined)
— get the offset from a line/column based Point in the bound indices;
returns undefined when given out of bounds input
toPoint ((offset?: number | null | undefined) => UnistPoint | undefined)
— get the line/column based Point for offset in the bound indices;
returns undefined when given out of bounds input
location(file)
Create an index of the given document to translate between line/column and
offset based positional info.
This package is fully typed with TypeScript.
It exports the additional type Location.
Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, vfile-location@^5,
compatible with Node.js 16.