8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ ** unist** ] [ unist ] utility to check if a [ node] [ ] is [ * generated* ] [ generated ] .
11
+ [ unist] [ ] utility to check if a node is generated.
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
+ * [ ` generated(node) ` ] ( #generatednode )
21
+ * [ Types] ( #types )
22
+ * [ Compatibility] ( #compatibility )
23
+ * [ Related] ( #related )
24
+ * [ Contribute] ( #contribute )
25
+ * [ License] ( #license )
26
+
27
+ ## What is this?
28
+
29
+ This utility can be used to check if a node is said to be [ generated] [ ] .
14
30
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.
31
+ ## When should I use this?
17
32
18
- [ npm] [ ] :
33
+ You can use this utility to check is generated.
34
+ Generated nodes were not in the source of the original file, and thus not
35
+ authored by a human.
36
+ This info can then be used to not emit lint messages for generated content.
37
+
38
+ You might also find the utility [ ` unist-util-position ` ] [ unist-util-position ]
39
+ useful to get clean positional info.
40
+ To display positional info to users, use
41
+ [ ` unist-util-stringify-position ` ] [ unist-util-stringify-position ] .
42
+
43
+ ## Install
44
+
45
+ This package is [ ESM only] [ esm ] .
46
+ In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [ npm] [ ] :
19
47
20
48
``` sh
21
49
npm install unist-util-generated
22
50
```
23
51
52
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
53
+
54
+ ``` js
55
+ import {generated } from " https://esm.sh/unist-util-generated@2"
56
+ ```
57
+
58
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
59
+
60
+ ``` html
61
+ <script type =" module" >
62
+ import {generated } from " https://esm.sh/unist-util-generated@2?bundle"
63
+ </script >
64
+ ```
65
+
24
66
## Use
25
67
26
68
``` js
@@ -37,36 +79,44 @@ generated({
37
79
38
80
## API
39
81
40
- This package exports the following identifiers: ` generated ` .
82
+ This package exports the identifier ` generated ` .
41
83
There is no default export.
42
84
43
85
### ` generated(node) `
44
86
45
- Check if [ ` node ` ] [ node ] is [ * generated* ] [ generated ] .
87
+ Check if ` node ` ([ ` Node ` ] [ node ] ) is * [ generated] [ ] * .
88
+
89
+ ###### Returns
46
90
47
- ###### Parameters
91
+ Whether ` node ` is generated ( ` boolean ` ).
48
92
49
- * ` node ` ( [ ` Node ` ] [ node ] ) — Node to check.
93
+ ## Types
50
94
51
- ###### Returns
95
+ This package is fully typed with [ TypeScript] [ ] .
96
+ It exports no additional types.
97
+
98
+ ## Compatibility
52
99
53
- ` boolean ` — Whether ` node ` is generated.
100
+ Projects maintained by the unified collective are compatible with all maintained
101
+ versions of Node.js.
102
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
103
+ Our projects sometimes work with older versions, but this is not guaranteed.
54
104
55
105
## Related
56
106
57
107
* [ ` unist-util-position ` ] ( https://github.com/syntax-tree/unist-util-position )
58
- — Get the position of nodes
108
+ — get the position of nodes
59
109
* [ ` unist-util-source ` ] ( https://github.com/syntax-tree/unist-util-source )
60
- — Get the source of a node or position
110
+ — get the source of a node or position
61
111
* [ ` unist-util-remove-position ` ] ( https://github.com/syntax-tree/unist-util-remove-position )
62
- — Remove ` position ` s from a tree
112
+ — remove ` position ` s
63
113
* [ ` unist-util-stringify-position ` ] ( https://github.com/syntax-tree/unist-util-stringify-position )
64
- — Stringify a node, position, or point
114
+ — serialize positional info
65
115
66
116
## Contribute
67
117
68
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
69
- started.
118
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
119
+ ways to get started.
70
120
See [ ` support.md ` ] [ support ] for ways to get help.
71
121
72
122
This project has a [ code of conduct] [ coc ] .
@@ -107,18 +157,30 @@ abide by its terms.
107
157
108
158
[ npm ] : https://docs.npmjs.com/cli/install
109
159
160
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
161
+
162
+ [ esmsh ] : https://esm.sh
163
+
164
+ [ typescript ] : https://www.typescriptlang.org
165
+
110
166
[ license ] : license
111
167
112
168
[ author ] : https://wooorm.com
113
169
114
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
170
+ [ health ] : https://github.com/syntax-tree/.github
115
171
116
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD/support .md
172
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
117
173
118
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
174
+ [ support ] : https://github.com/syntax-tree/.github/blob/main/support.md
175
+
176
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
119
177
120
178
[ unist ] : https://github.com/syntax-tree/unist
121
179
122
180
[ node ] : https://github.com/syntax-tree/unist#node
123
181
124
182
[ generated ] : https://github.com/syntax-tree/unist#generated
183
+
184
+ [ unist-util-position ] : https://github.com/syntax-tree/unist-util-position
185
+
186
+ [ unist-util-stringify-position ] : https://github.com/syntax-tree/unist-util-stringify-position
0 commit comments