Gathering detailed insights and metrics for vfile-location
Gathering detailed insights and metrics for vfile-location
Gathering detailed insights and metrics for vfile-location
Gathering detailed insights and metrics for vfile-location
@types/vfile-location
Stub TypeScript definitions entry for vfile-location, which provides its own types definitions
@flex-development/vfile-location
utility to convert between point (line/column) and offset (range) based locations
typed-vfile-location
unist-range
Renamed to `vfile-location`
utility to convert between positional (line and column-based) and offset (range-based) locations
npm install vfile-location
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
13 Stars
121 Commits
2 Forks
6 Watchers
1 Branches
10 Contributors
Updated on Jul 15, 2024
Latest Version
5.0.3
Package Id
vfile-location@5.0.3
Unpacked Size
12.78 kB
Size
4.77 kB
File Count
8
NPM Version
10.8.1
Node Version
22.0.0
Published on
Jul 15, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
vfile utility to convert between positional (line and column-based) and offsets (range-based) locations.
This is a tiny but useful package to convert between arbitrary places in a file.
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.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install vfile-location
In Deno with esm.sh
:
1import {location} from 'https://esm.sh/vfile-location@5'
In browsers with esm.sh
:
1<script type="module"> 2 import {location} from 'https://esm.sh/vfile-location@5?bundle' 3</script>
1import {VFile} from 'vfile' 2import {location} from 'vfile-location' 3 4const place = location(new VFile('foo\nbar\nbaz')) 5 6const offset = place.toOffset({line: 3, column: 3}) // => 10 7place.toPoint(offset) // => {line: 3, column: 3, offset: 10}
Location
Accessors for index.
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 inputtoPoint
((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 inputlocation(file)
Create an index of the given document to translate between line/column and offset based positional info.
Also implemented in Rust in wooorm/markdown-rs
.
file
(VFile | Value
)
— file to indexAccessors for index (Location
).
This package is fully typed with TypeScript.
It exports the additional type Location
.
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.
See contributing.md
in vfile/.github
for ways to
get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More