Socket
Socket
Sign inDemoInstall

vfile-location

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile-location - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

23

package.json
{
"name": "vfile-location",
"version": "2.0.4",
"version": "2.0.5",
"description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file",

@@ -19,19 +19,19 @@ "license": "MIT",

],
"dependencies": {},
"files": [
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^13.0.0",
"prettier": "^1.12.1",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^4.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.4.3",
"vfile": "^3.0.0",
"xo": "^0.23.0"
"tinyify": "^2.0.0",
"vfile": "^4.0.0",
"xo": "^0.24.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s vfileLocation > vfile-location.js",

@@ -61,7 +61,2 @@ "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js",

"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"object-shorthand": "off"
},
"ignores": [

@@ -68,0 +63,0 @@ "vfile-location.js"

@@ -6,12 +6,15 @@ # vfile-location

[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
Convert between positions (line and column-based) and offsets
(range-based) locations in a [virtual file][vfile].
Convert between positions (line and column-based) and offsets (range-based)
locations in a [virtual file][vfile].
## Installation
## Install
[npm][]:
```bash
```sh
npm install vfile-location

@@ -36,25 +39,26 @@ ```

Get transform functions for the given `doc` (`string`) or
[`file`][vfile].
Get transform functions for the given `doc` (`string`) or [`file`][vfile].
Returns an object with [`toOffset`][to-offset] and
[`toPosition`][to-position].
Returns an object with [`toOffset`][to-offset] and [`toPosition`][to-position].
### `location.toOffset(position)`
Get the `offset` (`number`) for a line and column-based
[`position`][position] in the bound file. Returns `-1`
when given invalid or out of bounds input.
Get the `offset` (`number`) for a line and column-based [`position`][position]
in the bound file.
Returns `-1` when given invalid or out of bounds input.
### `location.toPosition(offset)`
Get the line and column-based [`position`][position] for `offset` in
the bound file.
Get the line and column-based [`position`][position] for `offset` in the bound
file.
## Contribute
See [`contributing.md` in `vfile/vfile`][contributing] for ways to get started.
See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to
get started.
See [`support.md`][support] for ways to get help.
This organisation has a [Code of Conduct][coc]. By interacting with this
repository, organisation, or community you agree to abide by its terms.
This project has a [Code of Conduct][coc].
By interacting with this repository, organisation, or community you agree to
abide by its terms.

@@ -79,2 +83,12 @@ ## License

[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-location.svg
[size]: https://bundlephobia.com/result?p=vfile-location
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg

@@ -86,2 +100,10 @@

[contributing]: https://github.com/vfile/.github/blob/master/contributing.md
[support]: https://github.com/vfile/.github/blob/master/support.md
[health]: https://github.com/vfile/.github
[coc]: https://github.com/vfile/.github/blob/master/code-of-conduct.md
[license]: license

@@ -98,5 +120,1 @@

[position]: https://github.com/syntax-tree/unist#position
[contributing]: https://github.com/vfile/vfile/blob/master/contributing.md
[coc]: https://github.com/vfile/vfile/blob/master/code-of-conduct.md
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc