File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 4
4
* @typedef {Root|Content } Node
5
5
*
6
6
* @typedef Options
7
- * @property {boolean } [allowDashes=false]
8
- * @property {boolean } [allowApostrophes=false]
7
+ * Configuration.
8
+ * @property {boolean | null | undefined } [allowDashes=false]
9
+ * Do not strip hyphens (`-`).
10
+ *
11
+ * The default is to remove the hyphen-minus character.
12
+ * @property {boolean | null | undefined } [allowApostrophes=false]
13
+ * Do not strip apostrophes (`'`).
14
+ *
15
+ * The default is to remove apostrophes.
9
16
*/
10
17
11
18
import { toString } from 'nlcst-to-string'
12
19
13
20
/**
14
- * @param {string|Node|Array<Content> } node
15
- * @param {Options } [options={}]
21
+ * Normalize a word for easier comparison.
22
+ *
23
+ * Always normalizes smart apostrophes (`’`) to straight apostrophes (`'`) and
24
+ * lowercases alphabetical characters (`[A-Z]`).
25
+ *
26
+ * @param {string | Node | Array<Content> } node
27
+ * Word.
28
+ * @param {Options | null | undefined } [options]
29
+ * Configuration.
30
+ * @returns {string }
31
+ * Normalized word.
16
32
*/
17
33
export function normalize ( node , options ) {
18
34
let value = ( typeof node === 'string' ? node : toString ( node ) )
You can’t perform that action at this time.
0 commit comments