{"name":"unist-util-position-from-estree","version":"1.1.1","description":"unist utility to get a position from an estree node","license":"MIT","keywords":["unist","unist-util","util","utility","recma","esast","estree","javascript","ecmascript","node","position"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/unist-util-position-from-estree.git"},"bugs":{"url":"https://github.com/syntax-tree/unist-util-position-from-estree/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/acorn":"^4.0.0","@types/tape":"^4.0.0","acorn":"^8.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.44.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","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --experimental-modules 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":"a1952feaa1bc50fe51e5ba87e63f1a1c01a02b61","homepage":"https://github.com/syntax-tree/unist-util-position-from-estree#readme","_id":"unist-util-position-from-estree@1.1.1","_nodeVersion":"16.6.1","_npmVersion":"7.20.3","dist":{"integrity":"sha512-xtoY50b5+7IH8tFbkw64gisG9tMSpxDjhX9TmaJJae/XuxQ9R/Kc8Nv1eOsf43Gt4KV/LkriMy9mptDr7XLcaw==","shasum":"96f4d543dfb0428edc01ebb928570b602d280c4c","tarball":"http://registry-npm.ywwl.com/unist-util-position-from-estree/download/unist-util-position-from-estree-1.1.1.tgz","fileCount":5,"unpackedSize":9928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFUhjCRA9TVsSAnZWagAAIjYP/0RkvPnke+EwgckzKeJo\nr4mTItkQucbPhozImLjCmOsAodXVoLT39qzSuk6qHlq/6rXMPCxwsyLnReg6\n4l30HRsizfXo5mktldomFAwBlV9a1HLCPid+izI51bctFa9CSidOXbtgWnkd\nNYOvATcuGG62KGvMThO1VHLwXOP+BDRssfyAMKm0dT2mzovwBlSL04IUxRm8\n/Dadcwi4aUVEYxrA7Sbbl1iRBfC5gHBrsyHGjU44yymqB2U2SsHHL0PiUCbZ\nXoK18yJFyghetzmFt80edARITSo+vt4s4yaKCFvGcRKsKLTd12BgAVCQXTYE\nvtQuLZv+PR2ShBju6VNlDGmn3hI2TgMA1Pcd7SXm4UMH/ZI2OmwBJIJjJz19\nu52/tAarCpMqZAXUnQ3YPg4/Az8nRLadZgVH56Q7Xn5AFf+BfT/J2OqJ7PCr\nQgbEcdNkQeDFRRiOjo1krENhgJZpsKMoegKTAsepeUNJJN1sNAyFUTsPqfbZ\nOMO5hYNOF/7LvcWo6cXOK79LRlNElMwPn0JyYGYjLLlC9k8JhLLLqZRgMKeV\nZ34iROBCUPeie0UlfLrSbRsiwmPlD7Rp1e9LfYcpVq5MGISCNTva955AoIbd\nm73TaCgrZWm7q6oDZ0UVb0OdZMBUYUgTm6pRwwJmB+Mn6YomzFXXInjGltMp\nIiXu\r\n=X13G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsr9JZvvHxA3LElpHgpktWd9KQqYEmeP6LwqUMxe/KCQIhAOqsN9ulLuuek8FTElvZmkyPIzwgmwFqWQqNyWJsUvRM"}],"size":3395,"noattachment":false,"key":"/unist-util-position-from-estree/-/unist-util-position-from-estree-1.1.1.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-from-estree_1.1.1_1628784739367_0.04721870552598051"},"_hasShrinkwrap":false,"readme":"# unist-util-position-from-estree\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 a position from an [estree][] node.\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    *   [`positionFromEstree(node)`](#positionfromestreenode)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a tiny utility that can create a proper unist position from\nan estree node\n\n## When should I use this?\n\nYou can use this package when you want to use other unist utilities with estree\nnodes.\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-from-estree\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@2?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {parse} from 'acorn'\nimport {positionFromEstree} from 'unist-util-position-from-estree'\n\n// Make acorn support line/column.\nconst node = parse('function x() { console.log(1) }', {\n  ecmaVersion: 2020,\n  locations: true\n})\n\nconsole.log(positionFromEstree(node)) // `Program`\nconsole.log(positionFromEstree(node.body[0].id)) // `x`\nconsole.log(positionFromEstree(node.body[0].body.body[0].expression)) // Call\n```\n\nYields:\n\n```js\n{\n  start: {line: 1, column: 1, offset: 0},\n  end: {line: 1, column: 32, offset: 31}\n}\n{\n  start: {line: 1, column: 10, offset: 9},\n  end: {line: 1, column: 11, offset: 10}\n}\n{\n  start: {line: 1, column: 16, offset: 15},\n  end: {line: 1, column: 30, offset: 29}\n}\n```\n\n## API\n\nThis package exports the identifier [`positionFromEstree`][positionfromestree].\nThere is no default export.\n\n### `positionFromEstree(node)`\n\nTurn an estree `node` into a unist `position`.\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — estree node\n\n###### Returns\n\nunist position, if valid ([`Position`][position] 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,\n`unist-util-position-from-estree@^2`, compatible with Node.js 16.\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<!-- Definition -->\n\n[build-badge]: https://github.com/syntax-tree/unist-util-position-from-estree/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/unist-util-position-from-estree/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-position-from-estree.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/unist-util-position-from-estree\n\n[downloads-badge]: https://img.shields.io/npm/dm/unist-util-position-from-estree.svg\n\n[downloads]: https://www.npmjs.com/package/unist-util-position-from-estree\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-from-estree\n\n[size]: https://bundlejs.com/?q=unist-util-position-from-estree\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[estree]: https://github.com/estree/estree\n\n[node]: https://github.com/estree/estree/blob/master/es5.md#node-objects\n\n[unist]: https://github.com/syntax-tree/unist\n\n[position]: https://github.com/syntax-tree/unist#position\n\n[positionfromestree]: #positionfromestreenode\n","publish_time":1628784739545,"_cnpm_publish_time":1628784739545,"dist-tags":{"latest":"2.0.0"}}