Skip to content

Commit b12911f

Browse files
committed
Add improved docs
1 parent 6ff7a64 commit b12911f

File tree

1 file changed

+74
-15
lines changed

1 file changed

+74
-15
lines changed

readme.md

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,54 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
[**nlcst**][nlcst] utility to normalize a word for easier comparison.
11+
[nlcst][] utility to normalize a word for easier comparison.
1212

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+
* [`normalize(value[, options])`](#normalizevalue-options)
21+
* [Types](#types)
22+
* [Compatibility](#compatibility)
23+
* [Related](#related)
24+
* [Contribute](#contribute)
25+
* [License](#license)
26+
27+
## What is this?
28+
29+
This utility serializes a node and cleans it.
30+
31+
## When should I use this?
32+
33+
This package is a tiny utility that helps when comparing natural language to
34+
word lists.
1435

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.
36+
## Install
1737

18-
[npm][]:
38+
This package is [ESM only][esm].
39+
In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]:
1940

2041
```sh
2142
npm install nlcst-normalize
2243
```
2344

45+
In Deno with [`esm.sh`][esmsh]:
46+
47+
```js
48+
import {normalize} from "https://esm.sh/nlcst-normalize@3"
49+
```
50+
51+
In browsers with [`esm.sh`][esmsh]:
52+
53+
```html
54+
<script type="module">
55+
import {normalize} from "https://esm.sh/nlcst-normalize@3?bundle"
56+
</script>
57+
```
58+
2459
## Use
2560

2661
```js
@@ -44,7 +79,7 @@ normalize({
4479

4580
## API
4681

47-
This package exports the following identifiers: `normalize`.
82+
This package exports the identifier `normalize`.
4883
There is no default export.
4984

5085
### `normalize(value[, options])`
@@ -54,25 +89,41 @@ comparison.
5489
Always normalizes smart apostrophes (``) to straight apostrophes (`'`) and
5590
lowercases alphabetical characters (`[A-Z]`).
5691

92+
##### `options`
93+
94+
Configuration (optional).
95+
5796
###### `options.allowApostrophes`
5897

59-
`boolean`, default: `false`Do not strip apostrophes (`'`).
98+
Do not strip apostrophes (`'`) (`boolean`, default: `false`).
6099

61100
###### `options.allowDashes`
62101

63-
`boolean`, default: `false` — Do not strip hyphens (`-`).
102+
Do not strip hyphens (`-`) (`boolean`, default: `false`).
103+
104+
## Types
105+
106+
This package is fully typed with [TypeScript][].
107+
It exports the additional types `Options`.
108+
109+
## Compatibility
110+
111+
Projects maintained by the unified collective are compatible with all maintained
112+
versions of Node.js.
113+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
114+
Our projects sometimes work with older versions, but this is not guaranteed.
64115

65116
## Related
66117

67118
* [`nlcst-is-literal`](https://github.com/syntax-tree/nlcst-is-literal)
68-
Check whether a node is meant literally
119+
check whether a node is meant literally
69120
* [`nlcst-search`](https://github.com/syntax-tree/nlcst-search)
70-
Search for patterns
121+
search for patterns
71122

72123
## Contribute
73124

74-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
75-
started.
125+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
126+
ways to get started.
76127
See [`support.md`][support] for ways to get help.
77128

78129
This project has a [code of conduct][coc].
@@ -113,15 +164,23 @@ abide by its terms.
113164

114165
[npm]: https://docs.npmjs.com/cli/install
115166

167+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
168+
169+
[esmsh]: https://esm.sh
170+
171+
[typescript]: https://www.typescriptlang.org
172+
116173
[license]: license
117174

118175
[author]: https://wooorm.com
119176

120-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
177+
[health]: https://github.com/syntax-tree/.github
178+
179+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
121180

122-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
181+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
123182

124-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
183+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
125184

126185
[nlcst]: https://github.com/syntax-tree/nlcst
127186

0 commit comments

Comments
 (0)