{"name":"unist-util-position","version":"4.0.3","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/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^10.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.48.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","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":"958e7792abafa3ea76f18b8dc0d9a5ffe9fca529","homepage":"https://github.com/syntax-tree/unist-util-position#readme","_id":"unist-util-position@4.0.3","_nodeVersion":"17.4.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-p/5EMGIa1qwbXjA+QgcBXaPWjSnZfQ2Sc3yBEEfgPwsEmJd8Qh+DSk3LGnmOM4S1bY2C0AjmMnB8RuEYxpPwXQ==","shasum":"5290547b014f6222dff95c48d5c3c13a88fadd07","tarball":"http://registry-npm.ywwl.com/unist-util-position/download/unist-util-position-4.0.3.tgz","fileCount":5,"unpackedSize":8461,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHiW9wfkhDi4+IxLAyt94khsU2U1yhEHJC247g81V6qGAiAOfcsSCK3swkh7tNU67CJQ6QAQisTc+9jEide4oizThQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiRbQcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6iw/+PkMpmSEh08Da2XBoUm3+8cuf8Uq6BahvnZM3JZ+7NOxQC99L\r\nqctuLxowIktjZcI+QAKJ7T/tuMmNwI3I1RpC7amDgCQw+wQW1hX74LRZwTiC\r\n4jETfUIcXKZ57flr1kybsaIP7LUv0MVpys63vLlGwTwTXO8voEoKMGGkoeTU\r\nVf6/kvuetRy+JwKUXfmWYFs340VduiCkeNq6/u5CwDwMa5rADoD5E6xlJ7T3\r\nvl+ABMYdYNFSU58dyUEkR7ymDTnvRqhUb7o+i3HfSnK6lOJrDchCVEWzchcJ\r\ndu/kTlc4AdYTw5N8HIqiudAk3/7wOyYox3jhwe/WyuZi6FCCOelOCaZERhTk\r\nRXqr/jJ8l/ZtdJdxeuV2Ffh065oexW4iy4uJPpBIcDePmp5zzPqj7GsTseMB\r\n+N/D8PrfoRyvyaTt781rRB3RG0V9GAcbzV5RrURk7xmQAbrgPo9scmKt/yLf\r\neIjO3R3xS2utd2uX+Z+dZvg2VM+BXEgql2xSnOwXFMYHCyXwaD15xuAIxRw2\r\n0kPH6MWaD3JJ50Qrn92QuS9UtNQ0hCRQC9pqtT8xmHy/Nyow/g9Ktz7/CHcJ\r\nGPzfGS3hkRbdiEzm8f1rKQkR9IreUFE/UXL8lCeiHV/dNERHmMM4AxL+Liq0\r\nxk73I0p3d8RMnmdprfgs72KQ5ELPdHZ6OQ0=\r\n=q8Ia\r\n-----END PGP SIGNATURE-----\r\n","size":3199,"noattachment":false,"key":"/unist-util-position/-/unist-util-position-4.0.3.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.3_1648735259836_0.9352021141653841"},"_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":1648735259982,"_cnpm_publish_time":1648735259982,"dist-tags":{"latest":"5.0.0"}}