{"name":"unist-util-position","version":"4.0.4","description":"unist utility to get the position of a node","license":"MIT","keywords":["unist","unist-util","util","utility","node","position","point"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/unist-util-position.git"},"bugs":{"url":"https://github.com/syntax-tree/unist-util-position/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"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/unist":"^2.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"d086c6cf50f1206d47bbf8eff4411ec47a771165","homepage":"https://github.com/syntax-tree/unist-util-position#readme","_id":"unist-util-position@4.0.4","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==","shasum":"93f6d8c7d6b373d9b825844645877c127455f037","tarball":"http://registry-npm.ywwl.com/unist-util-position/download/unist-util-position-4.0.4.tgz","fileCount":7,"unpackedSize":12435,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFr9O/hB+uoM811/aQV6MBY2+UFTgjqyy7p1ktwuLAMPAiABN2k3G2Cw5SXwaZaJ74YrIw+J3rvLmpv16rY3xSNfmA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjzBucACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpnxAAk/mrc8R4keY57VHR/vhIghEml9u91CO+d0b9Hq7/cOdG4gKZ\r\nqbMLRZj3Phzw1RFtO/Vuzxy9aQtfQx+LFTtZ/w4TJ89xt20sKmB7oDUssKoL\r\n27FX6kELzUj3FcJh48RD3sKVZkIMusSB2/7vm+yfwZYTrtgRA1ejCP3MAwYr\r\nVBF2TniCVnvf+TYNC4/7YCdSsNuZeUFc9Q2nKosq0cwaf1iNeq9NFO1go/QI\r\nJVEIlPsSK56FT/TM+UF6yaNAT55DEJyOoOyuQrrEJuBVnmFZ9iYEOz8yNjLj\r\nogOfU1rDeY5pSWNKAYuNz1PgM8pD7uBT9BJotwEodqb4sR1LRNC3OARIaRD3\r\nM0qP2njg4w9yiNH7KutZOJmDuh6g9WfSogXmkJFiPFBSQA2GUYqUfDKk7uCQ\r\nCafCtPLoWBoZn0sdjFvvfNGmscd88R/2Ews+zvsYvnC1BOarO8RhwLzLyqr1\r\nzYPMgcGBYCXjGJ9g8kXMHL3a1iR8r6c6N1lPWaPXyoRXYLH99hlyBe90d281\r\npp/maHH3SWh0eL0hSbzEJYQX0CBO6X5rI9vIBez7EcGwTyhwkqHAqtEq8JSj\r\nbyQLVqI9t6UyqDhxJhD/RrvKy2CHx3tW8fn8aoH9g8Nlm4xEjooKKuW7FYiU\r\np/r8qe48aWPll0RUVKEA0oAQPd6J4i1P79s=\r\n=B3UB\r\n-----END PGP SIGNATURE-----\r\n","size":4296,"noattachment":false,"key":"/unist-util-position/-/unist-util-position-4.0.4.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-util-position_4.0.4_1674320796334_0.8184789449587861"},"_hasShrinkwrap":false,"readme":"# unist-util-position\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[unist][] utility to get positional info of nodes.\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    *   [`position(node)`](#positionnode)\n    *   [`pointEnd(node)`](#pointendnode)\n    *   [`pointStart(node)`](#pointstartnode)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis utility helps with accessing positional info on a potentially dirty tree.\n\n## When should I use this?\n\nThe positional info is typically consistent and proper in unist trees generated\nby our ecosystem, but, user plugins could mess that up.\nIf you’re making a reusable plugin, and accessing the positional info often, you\nmight want to guard against that by using this utility.\n\nYou might also find the utility [`unist-util-generated`][unist-util-generated]\nuseful to check whether a node is considered to be generated (not in the\noriginal input file).\n\nYou might also enjoy\n[`unist-util-stringify-position`][unist-util-stringify-position] when you want\nto display positional info 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 unist-util-position\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {pointEnd, pointStart, position} from 'unist-util-position'\n\nconst tree = fromMarkdown('# foo\\n\\n* bar\\n')\n\nconsole.log(position(tree))\nconsole.log(pointStart(tree))\nconsole.log(pointEnd(tree))\n```\n\nYields:\n\n```js\n{start: {line: 1, column: 1, offset: 0}, end: {line: 4, column: 1, offset: 13}}\n{line: 1, column: 1, offset: 0}\n{line: 4, column: 1, offset: 13}\n```\n\n## API\n\nThis package exports the identifiers [`pointEnd`][pointend],\n[`pointStart`][pointstart], and [`position`][position].\nThere is no default export.\n\n### `position(node)`\n\nGet the positional info of `node`.\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — node\n\n###### Returns\n\nPosition, if valid ([`Position`][unist-position] or `undefined`).\n\n### `pointEnd(node)`\n\nGet the ending point of `node`.\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — node\n\n###### Returns\n\nPoint, if valid ([`Point`][unist-point] or `undefined`).\n\n### `pointStart(node)`\n\nGet the starting point of `node`.\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — node\n\n###### Returns\n\nPoint, if valid ([`Point`][unist-point] or `undefined`).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\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, `unist-util-position@^5`,\ncompatible with Node.js 16.\n\n## Related\n\n*   [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position)\n    — serialize a node, position, or point as a human readable location\n*   [`unist-util-position-from-estree`](https://github.com/syntax-tree/unist-util-position-from-estree)\n    — get a position from an estree node\n*   [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position)\n    — remove positions from tree\n*   [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated)\n    — check if a node is generated\n*   [`unist-util-source`](https://github.com/syntax-tree/unist-util-source)\n    — get the source of a node\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get 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/syntax-tree/unist-util-position/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/unist-util-position/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-position.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/unist-util-position\n\n[downloads-badge]: https://img.shields.io/npm/dm/unist-util-position.svg\n\n[downloads]: https://www.npmjs.com/package/unist-util-position\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-position\n\n[size]: https://bundlejs.com/?q=unist-util-position\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/syntax-tree/unist/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[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[unist]: https://github.com/syntax-tree/unist\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[unist-position]: https://github.com/syntax-tree/unist#position\n\n[unist-point]: https://github.com/syntax-tree/unist#point\n\n[unist-util-generated]: https://github.com/syntax-tree/unist-util-generated\n\n[unist-util-stringify-position]: https://github.com/syntax-tree/unist-util-stringify-position\n\n[position]: #positionnode\n\n[pointend]: #pointendnode\n\n[pointstart]: #pointstartnode\n","publish_time":1674320796500,"_cnpm_publish_time":1674320796500,"dist-tags":{"latest":"5.0.0"}}