{"name":"unist-util-position-from-estree","version":"1.1.0","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":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.38.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,"rules":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"e0d92dc7b78dd51e46614cddc6cfe1b81a29ac8d","homepage":"https://github.com/syntax-tree/unist-util-position-from-estree#readme","_id":"unist-util-position-from-estree@1.1.0","_nodeVersion":"15.11.0","_npmVersion":"7.6.2","dist":{"integrity":"sha512-FveBeLp2Oc5XTn8DCX++DB4ETP8BaiRl0DuVGdD8s5I+V/boj81rBm0pNdwAixXUtGvVdsinPOT+Thy2yFrMEA==","shasum":"31f5e0f771629ec718443765e10ea590231760c7","tarball":"http://registry-npm.ywwl.com/unist-util-position-from-estree/download/unist-util-position-from-estree-1.1.0.tgz","fileCount":5,"unpackedSize":8911,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdt8gCRA9TVsSAnZWagAA6QYP/jMlR79FB6MvhmGJ4do5\ns0DejI7cEXM586zF1qeiib4E6vo09dkyOzzfgjPTfBNXWiXhvQ6fv1JRQJHG\n7oqmtCTyCoqSPW9wGjaNUTK+8D7bjQFqX42uDey0d6p3TTniFmIZbSNcel1F\nIvjZhf9A5CBCrOFVXM09MKLSGUw4k26qCI8fXHhtHXU1hYObW06lPTNELsJC\nmIrZ4odHP/tiVE8eOXf2znba+IVsQQ1dS/o7bf86W3+N3ygG66wLg3MlFfFp\nxCDCndgOEetLkyz5dryojf6Ykl0qqTnRV8I/G3feGnFEeDiLE60pPIzpbwQC\noEgHCyKHRMY9igBRad9H74ZLgpVyDUelOdb+Y/Jw30SqrNl4Omhg+180d/wT\nXaktWKH2lc2Aq4vKsU9eWw9YADikSREfGzu7ik7PFEyJM5i18Sk1an9ciSYP\nQNOAPAqPpKX+rlGjkJuS6VqcwLZw5K4mw5pWVPJLVkR0DhXnCc0Upl58oeLD\ngA1p9e73BARtjgFADjutKOeeMGMXA2X2sSB0NSZKn9Zjen5RaVgosFMt9Lw7\nllorYbhi2hgl3+gPC0O5JegxI6w/9CAntnuYHdtJ2cP3pJYlgns7DytR182V\nFmow5sCSpa4vhT2QTzzpgqcaIBNhjxq70Mywn/PVudmtZVIAJXdFR/8lcdfD\n9HJB\r\n=THTF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDB5eY/A9fXyPKSD8922xde4Qfr+9N9HTk1LhYHg/1LIgIhAPiF6GLtXFDjVmXLmrwOt2z8/SaUvuamUgtaNjdQdAQ6"}],"size":3305,"noattachment":false,"key":"/unist-util-position-from-estree/-/unist-util-position-from-estree-1.1.0.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.0_1618403103533_0.3981667235675921"},"_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":1618403103676,"_cnpm_publish_time":1618403103676,"dist-tags":{"latest":"2.0.0"}}