nlcst-normalize
nlcst utility to normalize a word for easier comparison.
Install
npm:
npm install nlcst-normalize
Usage
var normalize = require('nlcst-normalize')
normalize("Don't")
normalize('Don’t')
normalize('Don’t', {allowApostrophes: true})
normalize('Block-level')
normalize('Block-level', {allowDashes: true})
normalize({
type: 'WordNode',
children: [
{type: 'TextNode', value: 'Block'},
{type: 'PunctuationNode', value: '-'},
{type: 'TextNode', value: 'level'}
]
})
API
normalize(value[, options])
Normalize a word (string
, Node
, Array.<Node>
) for easier
comparison. Always normalises smart apostrophes (’
) to straight
apostrophes ('
) and lowercases alphabetical characters ([A-Z]
).
options.allowApostrophes
boolean
, default: false
— Do not strip apostrophes ('
).
options.allowDashes
boolean
, default: false
— Do not strip hyphens (-
).
Contribute
See contributing.md
in syntax-tree/.github
for ways to get
started.
See support.md
for ways to get help.
This project has a Code of Conduct.
By interacting with this repository, organisation, or community you agree to
abide by its terms.
License
MIT © Titus Wormer