{"_id":"vfile-location@5.0.4","bugs":{"url":"https://github.com/vfile/vfile-location/issues"},"dist":{"shasum":"7e101a62d77ed528deb33c88c9839fb3be25b895","tarball":"http://registry-npm.ywwl.com/vfile-location/download/vfile-location-5.0.4.tgz","fileCount":8,"integrity":"sha512-vEvxatYZCIpNvzGk2UD+u4I/sZkSKoOsdRCbkOIsN73QpJbriJ1qvvBAL1PeI0y55Leoqf7pORbaSPpG/smmOg==","signatures":[{"sig":"MEYCIQDEvCcXmP1KNh85WaHg+myDksoOUseMX8dtw6XXmMykkAIhAODrQ4oV9GfiqHe8T4sBMwQFi+dKMu/bgyn/vk3P+YIC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHjKop2tVzv9leSE/s1ghJasB5zf2gP4js9iNxd+xbXhAiEAoUB2mOrnco/K3kBGRRlWHGOtayahiH7uYkUSvR5ynmk="}],"unpackedSize":12377,"size":4697,"noattachment":false,"key":"/vfile-location/-/vfile-location-5.0.4.tgz"},"name":"vfile-location","type":"module","types":"./index.d.ts","author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"bd1769596c073cf6448670d2dd6fff6ef8fec8c3","license":"MIT","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","prepack":"npm run build && npm run format","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"version":"5.0.4","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"homepage":"https://github.com/vfile/vfile-location#readme","keywords":["file","location","offset","point","position","utility","util","vfile-util","vfile","virtual"],"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/vfile/vfile-location.git","type":"git"},"_npmVersion":"12.2.2","description":"vfile utility to convert between positional (line and column-based) and offsets (range-based) locations","directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.12.1","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"dependencies":{"vfile":"^6.0.0","@types/unist":"^3.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm","remark-api"]},"typeCoverage":{"strict":true,"atLeast":100},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","prettier":"^3.0.0","remark-api":"^1.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","type-coverage":"^2.0.0","remark-preset-wooorm":"^11.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vfile-location_5.0.4_1793978623432_0.18923587074219606"},"readme":"# vfile-location\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n\n[vfile][github-vfile] utility to convert between positional\n(line and column-based) and offsets (range-based) locations.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`Location`](#location)\n  * [`location(file)`](#locationfile)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis is a tiny but useful package to convert between arbitrary places in a\nfile.\n\n## When should I use this?\n\nThis utility is useful when AST nodes don’t cut it.\nFor example, when you are making a lint rule that looks for dangerous\ncharacters in a file, which you accomplish by searching the raw file value,\nand still want to report it to users.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+), install with [npm][npmjs-install]:\n\n```sh\nnpm install vfile-location\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {location} from 'https://esm.sh/vfile-location@5?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {VFile} from 'vfile'\nimport {location} from 'vfile-location'\n\nconst place = location(new VFile('foo\\nbar\\nbaz'))\n\nconst offset = place.toOffset({line: 3, column: 3}) // => 10\nplace.toPoint(offset) // => {line: 3, column: 3, offset: 10}\n```\n\n## API\n\n### `Location`\n\nAccessors for index.\n\n###### Fields\n\n* `toOffset` (`(point?: PointLike | null | undefined) => number | undefined`)\n  — get the `offset` from a line/column based `Point` in the bound indices;\n  returns `undefined` when given out of bounds input\n* `toPoint` (`(offset?: number | null | undefined) => UnistPoint | undefined`)\n  — get the line/column based `Point` for `offset` in the bound indices;\n  returns `undefined` when given out of bounds input\n\n### `location(file)`\n\nCreate an index of the given document to translate between line/column and\noffset based positional info.\n\nAlso implemented in Rust in [`wooorm/markdown-rs`][github-markdown-rs].\n\n[github-markdown-rs]: https://github.com/wooorm/markdown-rs/blob/main/src/util/location.rs\n\n###### Parameters\n\n* `file` (`VFile | Value`)\n  — file to index\n\n###### Returns\n\nAccessors for index (`Location`).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Location`][api-location].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `vfile-location@^5`,\ncompatible with Node.js 16.\n\n## Contribute\n\nSee\n[`contributing.md`][health-contributing]\nin\n[`vfile/.github`][health]\nfor ways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-location]: #location\n\n[badge-build-image]: https://github.com/vfile/vfile-location/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/vfile/vfile-location/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg\n\n[badge-coverage-url]: https://codecov.io/github/vfile/vfile-location\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/vfile-location.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/vfile-location\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/vfile-location\n\n[badge-size-url]: https://bundlejs.com/?q=vfile-location\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-vfile]: https://github.com/vfile/vfile\n\n[health]: https://github.com/vfile/.github\n\n[health-coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/vfile/.github/blob/main/support.md\n\n[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","publish_time":1793978623532,"_cnpm_publish_time":1793978623532,"dist-tags":{"latest":"5.0.4"}}