8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ ** nlcst** ] [ nlcst ] utility to check if a node is meant literally.
11
+ [ nlcst] [ ] utility to check if a node is meant literally.
12
12
13
- Useful if a tool wants to exclude values that are possibly void of meaning.
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
+ * [ ` isLiteral(parent, index|child) ` ] ( #isliteralparent-indexchild )
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 check if a node is meant literally.
30
+
31
+ ## When should I use this?
32
+
33
+ This package is a tiny utility that helps when dealing with words.
34
+ It’s useful if a tool wants to exclude values that are possibly void of
35
+ meaning.
14
36
For example, a spell-checker could exclude these literal words, thus not warning
15
37
about “monsieur”.
16
38
17
39
## Install
18
40
19
- This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
20
- Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d.
21
-
22
- [ npm] [ ] :
41
+ This package is [ ESM only] [ esm ] .
42
+ In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [ npm] [ ] :
23
43
24
44
``` sh
25
45
npm install nlcst-is-literal
26
46
```
27
47
48
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
49
+
50
+ ``` js
51
+ import {isLiteral } from " https://esm.sh/nlcst-is-literal@2"
52
+ ```
53
+
54
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
55
+
56
+ ``` html
57
+ <script type =" module" >
58
+ import {isLiteral } from " https://esm.sh/nlcst-is-literal@2?bundle"
59
+ </script >
60
+ ```
61
+
28
62
## Use
29
63
30
- Say we have the following file, ` example.txt ` :
64
+ Say our document ` example.txt ` contains :
31
65
32
66
``` txt
33
67
The word “foo” is meant as a literal.
@@ -41,7 +75,7 @@ The word, qux, is meant as a literal.
41
75
The word — quux — is meant as a literal.
42
76
```
43
77
44
- And our script, ` example.js ` , looks as follows:
78
+ …and our module ` example.js ` looks as follows:
45
79
46
80
``` js
47
81
import {readSync } from ' to-vfile'
@@ -64,7 +98,7 @@ function visitor(node, index, parent) {
64
98
}
65
99
```
66
100
67
- Now, running ` node example ` yields:
101
+ …now running ` node example.js ` yields:
68
102
69
103
``` txt
70
104
foo
@@ -76,31 +110,43 @@ quux
76
110
77
111
## API
78
112
79
- This package exports the following identifiers: ` isLiteral ` .
113
+ This package exports the identifier ` isLiteral ` .
80
114
There is no default export.
81
115
82
116
### ` isLiteral(parent, index|child) `
83
117
84
118
Check if the ` child ` in ` parent ` is enclosed by matching delimiters.
85
- If ` index ` is given, the [ child] [ ] of ` parent ` at that [ index] [ ] is checked.
119
+ If an ` index ` is given, the [ child] [ ] of ` parent ` at that [ index] [ ] is checked.
86
120
87
121
For example, ` foo ` is literal in the following samples:
88
122
89
123
* ` Foo - is meant as a literal. `
90
124
* ` Meant as a literal is - foo. `
91
125
* ` The word “foo” is meant as a literal. `
92
126
127
+ ## Types
128
+
129
+ This package is fully typed with [ TypeScript] [ ] .
130
+ It exports no additional types.
131
+
132
+ ## Compatibility
133
+
134
+ Projects maintained by the unified collective are compatible with all maintained
135
+ versions of Node.js.
136
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
137
+ Our projects sometimes work with older versions, but this is not guaranteed.
138
+
93
139
## Related
94
140
95
141
* [ ` nlcst-normalize ` ] ( https://github.com/syntax-tree/nlcst-normalize )
96
- — Normalize a word for easier comparison
142
+ — normalize a word for easier comparison
97
143
* [ ` nlcst-search ` ] ( https://github.com/syntax-tree/nlcst-search )
98
- — Search for patterns
144
+ — search for patterns
99
145
100
146
## Contribute
101
147
102
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
103
- started.
148
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
149
+ ways to get started.
104
150
See [ ` support.md ` ] [ support ] for ways to get help.
105
151
106
152
This project has a [ code of conduct] [ coc ] .
@@ -141,15 +187,23 @@ abide by its terms.
141
187
142
188
[ npm ] : https://docs.npmjs.com/cli/install
143
189
190
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
191
+
192
+ [ esmsh ] : https://esm.sh
193
+
194
+ [ typescript ] : https://www.typescriptlang.org
195
+
144
196
[ license ] : license
145
197
146
198
[ author ] : https://wooorm.com
147
199
148
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
200
+ [ health ] : https://github.com/syntax-tree/.github
201
+
202
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
149
203
150
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD /support.md
204
+ [ support ] : https://github.com/syntax-tree/.github/blob/main /support.md
151
205
152
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD /code-of-conduct.md
206
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main /code-of-conduct.md
153
207
154
208
[ nlcst ] : https://github.com/syntax-tree/nlcst
155
209
0 commit comments