Socket
Socket
Sign inDemoInstall

nlcst-normalize

Package Overview
Dependencies
1
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nlcst-normalize

nlcst utility to normalize a word for easier comparison


Version published
Maintainers
2
Install size
12.7 kB
Created

Readme

Source

nlcst-normalize

Build Coverage Downloads Size Sponsors Backers Chat

nlcst utility to normalize a word for easier comparison.

Install

npm:

npm install nlcst-normalize

Use

var normalize = require('nlcst-normalize')

normalize("Don't") // => 'dont'
normalize('Don’t') // => 'dont'
normalize('Don’t', {allowApostrophes: true}) // => 'don\'t'
normalize('Block-level') // => 'blocklevel'
normalize('Block-level', {allowDashes: true}) // => 'block-level'

normalize({
  type: 'WordNode',
  children: [
    {type: 'TextNode', value: 'Block'},
    {type: 'PunctuationNode', value: '-'},
    {type: 'TextNode', value: 'level'}
  ]
}) // => 'blocklevel'

API

normalize(value[, options])

Normalize a word (string, Node, Array.<Node>) for easier comparison. Always normalizes 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, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Last updated on 01 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc