Skip to content

Commit ce52f09

Browse files
committed
Refactor code-style
* Add more docs to JSDoc * Add support for `null` in input of API types
1 parent 5c87dd3 commit ce52f09

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

lib/index.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,31 @@
44
* @typedef {Root|Content} Node
55
*
66
* @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.
916
*/
1017

1118
import {toString} from 'nlcst-to-string'
1219

1320
/**
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.
1632
*/
1733
export function normalize(node, options) {
1834
let value = (typeof node === 'string' ? node : toString(node))

0 commit comments

Comments
 (0)