{"name":"vfile-location","version":"3.1.0","description":"vfile utility to convert between positional (line and column-based) and offset (range-based) locations","license":"MIT","keywords":["vfile","vfile-util","util","utility","virtual","file","location","point","position","offset"],"repository":{"type":"git","url":"git+https://github.com/vfile/vfile-location.git"},"bugs":{"url":"https://github.com/vfile/vfile-location/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"types":"types/index.d.ts","dependencies":{},"devDependencies":{"@types/unist":"^2.0.0","browserify":"^16.0.0","dtslint":"^3.0.0","nyc":"^15.0.0","prettier":"^2.0.0","remark-cli":"^8.0.0","remark-preset-wooorm":"^7.0.0","tape":"^5.0.0","tinyify":"^3.0.0","vfile":"^4.0.0","xo":"^0.33.0"},"scripts":{"format":"remark . -qfo && prettier . --write && xo --fix","build-bundle":"browserify . -s vfileLocation > vfile-location.js","build-mangle":"browserify . -s vfileLocation -p tinyify > vfile-location.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test-types":"dtslint types","test":"npm run format && npm run build && npm run test-coverage && npm run test-types"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"rules":{"unicorn/prefer-number-properties":"off"},"ignores":["vfile-location.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"7836dd00f860bc0e11c48b116f27a9562c53f2da","homepage":"https://github.com/vfile/vfile-location#readme","_id":"vfile-location@3.1.0","_nodeVersion":"14.7.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==","shasum":"81cd8a04b0ac935185f4fce16f270503fc2f692f","tarball":"http://registry-npm.ywwl.com/vfile-location/download/vfile-location-3.1.0.tgz","fileCount":5,"unpackedSize":8842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfP/1oCRA9TVsSAnZWagAAeW8P/iRSVFIigk7B3QS8uEUI\nb8EzVr9BRkkDHEV1lwnoBU7SQo7Kt7szyAmdLIduMCphkvQyA1wDUuxDxiul\nThxGqha3iul4JKoTRrsXFiMEkof5nJnxmv+PlyjSsBIbSippQ37nYy7Wb6/x\nJsGXWIqlp1bH9pIIRhfVKulWfX5qvZkXe9eJ54EnJe7cjnPRCo1OKeeGKEkN\nwq/TAyQU4APxaByEXi5zcgAq6tpA4EeV82Nz+oIvGNRhVuEVltou1EP+UXl2\ndVtYbcv9A1xtJtzdgWb0Ybyq1sX0PAuw9uXhQ6wCdqfbeqOGmLilU4XLpn2u\nJC4aRl1R7jyUC4iqE/DXLvO0tOlqXm95BZpwAG7G4A116DZpBDEClQQBOf7c\nCXVOoYgdmKN3rmhrfngv38Cgbz1WpmnXVFK48frH4EzbEm30OD1Nm6SdHiCC\nSDYoPyZSwNhLcvx0dw15K/tvdXky1/IMhsG+Zzuy9tVYbQd/V1E0jdOK5w5F\nu7bmSeswayFwFMo0LdqbvuL3DT9q0kQu2yqIjIY+c52tGofjnJZ/bjqi05F7\nhPCCR0P4q3mztHB5PZ+C4M4r1XbY4Y1zpULAGa99OP6hZbh44lYZ5gofk0Br\nIC+c6+iTcAFCfBq4AkIJvychWDx8VI+23b4GV/tsB3oWF6ypyD5J933pvMWo\ne+gC\r\n=ha2l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEYMCblLTVy27kILRwC4gp2SchOmS42XD7G9+98nE0HgAiEAug2tnH/Hh7aoirRFrD4YCLMXlPOhcm4aIwIQZhKCKaI="}],"size":3508,"noattachment":false,"key":"/vfile-location/-/vfile-location-3.1.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vfile-location_3.1.0_1598029159890_0.6092293120598822"},"_hasShrinkwrap":false,"readme":"# vfile-location\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[vfile][] utility to convert between positional (line and column-based) and\noffsets (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(file)`](#locationfile)\n    *   [`Location`](#location)\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 ASTs 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][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install vfile-location\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {location} from 'https://esm.sh/vfile-location@5'\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\nThis package exports the identifier [`location`][api-location].\nThere is no default export.\n\n### `location(file)`\n\nCreate an index of the given document to translate between line/column and\noffset based positional info.\n\n###### Parameters\n\n*   `file` ([`VFile`][vfile], `Buffer`, or `string`)\n    — file to index\n\n###### Returns\n\nAccessors for index ([`Location`][api-location-map]).\n\n### `Location`\n\nAccessors for index (TypeScript type).\n\n###### Fields\n\n*   `toPoint` (`(offset: number) => Point | undefined`)\n    — get the line/column based [`Point`][point] for `offset` in the bound\n    indices\n*   `toOffset` (`(point: Point) => number | undefined`)\n    — get the `offset` from a line/column based [`Point`][point] in the bound\n    indices\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Location`][api-location-map].\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 [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to\nget started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/vfile/vfile-location/workflows/main/badge.svg\n\n[build]: https://github.com/vfile/vfile-location/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg\n\n[coverage]: https://codecov.io/github/vfile/vfile-location\n\n[downloads-badge]: https://img.shields.io/npm/dm/vfile-location.svg\n\n[downloads]: https://www.npmjs.com/package/vfile-location\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=vfile-location\n\n[size]: https://bundlejs.com/?q=vfile-location\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/vfile/vfile/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[support]: https://github.com/vfile/.github/blob/main/support.md\n\n[health]: https://github.com/vfile/.github\n\n[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[vfile]: https://github.com/vfile/vfile\n\n[point]: https://github.com/syntax-tree/unist#point\n\n[api-location]: #locationfile\n\n[api-location-map]: #location\n","publish_time":1598029159981,"_cnpm_publish_time":1598029159981,"dist-tags":{"latest":"5.0.4"}}