{"name":"unist-util-position","version":"3.0.4","description":"Utility to get the position of unist nodes","license":"MIT","keywords":["unist","node","position","point","util","utility"],"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"}],"dependencies":{},"devDependencies":{"browserify":"^16.0.0","nyc":"^14.0.0","prettier":"^1.0.0","remark-cli":"^7.0.0","remark-preset-wooorm":"^6.0.0","tape":"^4.0.0","tinyify":"^2.0.0","xo":"^0.25.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","build-bundle":"browserify . -s unistUtilPosition > unist-util-position.js","build-mangle":"browserify . -s unistUtilPosition -p tinyify > unist-util-position.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"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,"ignores":["unist-util-position.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"7924cd7420ebb3c583d17b0fcafefbb7c9a6603f","homepage":"https://github.com/syntax-tree/unist-util-position#readme","_id":"unist-util-position@3.0.4","_nodeVersion":"13.0.1","_npmVersion":"6.13.0","dist":{"integrity":"sha512-tWvIbV8goayTjobxDIr4zVTyG+Q7ragMSMeKC3xnPl9xzIc0+she8mxXLM3JVNDDsfARPbCd3XdzkyLdo7fF3g==","shasum":"5872be7aec38629b971fdb758051f78817b0040a","tarball":"http://registry-npm.ywwl.com/unist-util-position/download/unist-util-position-3.0.4.tgz","fileCount":4,"unpackedSize":6355,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdx9kNCRA9TVsSAnZWagAAII8QAJZmxlJaBkmZj/WFRXN4\nw+dFSC7b+ixr7/1ca3WJPklOCLMNYEpKDJoXHUgoGqK9CV78Mz4HaNMdukbS\nUY8GTO8iaUg0uQvWP21kNm1mjAB4zCmKRW2zpk6F8s2ux1XLRoCOGf9BWxxO\nLsuKlpT2iTkKKs8Z71fcBfSbLNEwsgZ1otpzyH6VfwCN/eXr5SycAhMw5JZ1\nL+VDIrlF3IdIIymAV2Sku4+gn3RwkRwGgZuTcQDNBcvfT+n3jJBuFSU4bZWo\nGTbtlYDMhB07JTUr09wTm0GHDWf54FT6MDbIyai6DZ5wwM7k7vRQVBK0XcoO\njU+drO2o6uq0eDvpAXGERIk8Ql2nT3OGMD7EV6EgUkRNIxuClt2ArApFGw/N\nAIqHUvHBaoLQgGhJqcg6c4W9UEgm/H1ZazJkjcXP3a5T6Zqe7u1Q0L/GFFOa\nxN9y4mNfCLca43VhDK5nvEVtK7gAwzCV8OhfKanW5769l9epZMwIaYOyckW2\nZgT9hV3pgrKDIZlOtZRHusyojtZcPC2B+S0bgl8BcU2aZm0yl78gf9wMr+pB\nTWtxS3ELr+uPiojbGcNE+cNpkDx0V2O2gQNPu8508HtLLxJvgg0M8eCdk6Eg\nOZx+IRUVMLRk3/5zIZvQgdYiw3gmBLHGQOdARELZ2PrPpRkBKnIDBt2gUlOE\n4b8h\r\n=Z48I\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCISoNw+p14YfFkxVEMnfYteKm6XAVOGexzrbDsNSescwIhAOlSKMFSvpU+r87Q6TDG63oS4UG5rt7lHuMzMBCnMh5s"}],"size":2732,"noattachment":false,"key":"/unist-util-position/-/unist-util-position-3.0.4.tgz"},"maintainers":[{"email":"keith@mcknig.ht","name":"kmck"},{"email":"tituswormer@gmail.com","name":"wooorm"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-util-position_3.0.4_1573378317275_0.43227299556931564"},"_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":1573378317455,"_cnpm_publish_time":1573378317455,"dist-tags":{"latest":"5.0.0"}}