|
8 | 8 | [![Backers][backers-badge]][collective]
|
9 | 9 | [![Chat][chat-badge]][chat]
|
10 | 10 |
|
11 |
| -[**unist**][unist] utility to get a position from an [**estree**][estree] node. |
| 11 | +[unist][] utility to get a position from an [estree][] node. |
12 | 12 |
|
13 |
| -## Install |
| 13 | +## Contents |
| 14 | + |
| 15 | +* [What is this?](#what-is-this) |
| 16 | +* [When should I use this?](#when-should-i-use-this) |
| 17 | +* [Install](#install) |
| 18 | +* [Use](#use) |
| 19 | +* [API](#api) |
| 20 | + * [`positionFromEstree(node)`](#positionfromestreenode) |
| 21 | +* [Types](#types) |
| 22 | +* [Compatibility](#compatibility) |
| 23 | +* [Contribute](#contribute) |
| 24 | +* [License](#license) |
| 25 | + |
| 26 | +## What is this? |
14 | 27 |
|
15 |
| -This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): |
16 |
| -Node 12+ is needed to use it and it must be `import`ed instead of `require`d. |
| 28 | +This package is a tiny utility that can create a proper unist position from |
| 29 | +an estree node |
17 | 30 |
|
18 |
| -[npm][]: |
| 31 | +## When should I use this? |
| 32 | + |
| 33 | +You can use this package when you want to use other unist utilities with estree |
| 34 | +nodes. |
| 35 | + |
| 36 | +## Install |
| 37 | + |
| 38 | +This package is [ESM only][esm]. |
| 39 | +In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: |
19 | 40 |
|
20 | 41 | ```sh
|
21 | 42 | npm install unist-util-position-from-estree
|
22 | 43 | ```
|
23 | 44 |
|
| 45 | +In Deno with [`esm.sh`][esmsh]: |
| 46 | + |
| 47 | +```js |
| 48 | +import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@1' |
| 49 | +``` |
| 50 | + |
| 51 | +In browsers with [`esm.sh`][esmsh]: |
| 52 | + |
| 53 | +```html |
| 54 | +<script type="module"> |
| 55 | + import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@1?bundle' |
| 56 | +</script> |
| 57 | +``` |
| 58 | + |
24 | 59 | ## Use
|
25 | 60 |
|
26 | 61 | ```js
|
@@ -57,19 +92,29 @@ Yields:
|
57 | 92 |
|
58 | 93 | ## API
|
59 | 94 |
|
60 |
| -This package exports the following identifiers: `positionFromEstree`. |
| 95 | +This package exports the identifier `positionFromEstree`. |
61 | 96 | There is no default export.
|
62 | 97 |
|
63 | 98 | ### `positionFromEstree(node)`
|
64 | 99 |
|
65 | 100 | Given a [`node`][estree], returns a [`position`][position].
|
66 | 101 |
|
67 |
| -## Related |
| 102 | +## Types |
| 103 | + |
| 104 | +This package is fully typed with [TypeScript][]. |
| 105 | +It exports no additional types. |
| 106 | + |
| 107 | +## Compatibility |
| 108 | + |
| 109 | +Projects maintained by the unified collective are compatible with all maintained |
| 110 | +versions of Node.js. |
| 111 | +As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. |
| 112 | +Our projects sometimes work with older versions, but this is not guaranteed. |
68 | 113 |
|
69 | 114 | ## Contribute
|
70 | 115 |
|
71 |
| -See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get |
72 |
| -started. |
| 116 | +See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for |
| 117 | +ways to get started. |
73 | 118 | See [`support.md`][support] for ways to get help.
|
74 | 119 |
|
75 | 120 | This project has a [code of conduct][coc].
|
@@ -110,15 +155,23 @@ abide by its terms.
|
110 | 155 |
|
111 | 156 | [npm]: https://docs.npmjs.com/cli/install
|
112 | 157 |
|
| 158 | +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
| 159 | + |
| 160 | +[esmsh]: https://esm.sh |
| 161 | + |
| 162 | +[typescript]: https://www.typescriptlang.org |
| 163 | + |
113 | 164 | [license]: license
|
114 | 165 |
|
115 | 166 | [author]: https://wooorm.com
|
116 | 167 |
|
117 |
| -[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md |
| 168 | +[health]: https://github.com/syntax-tree/.github |
| 169 | + |
| 170 | +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md |
118 | 171 |
|
119 |
| -[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md |
| 172 | +[support]: https://github.com/syntax-tree/.github/blob/main/support.md |
120 | 173 |
|
121 |
| -[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md |
| 174 | +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md |
122 | 175 |
|
123 | 176 | [estree]: https://github.com/estree/estree
|
124 | 177 |
|
|
0 commit comments