{"id":13717120,"url":"https://github.com/syntax-tree/nlcst-normalize","last_synced_at":"2025-06-29T22:03:40.499Z","repository":{"id":62354819,"uuid":"49651015","full_name":"syntax-tree/nlcst-normalize","owner":"syntax-tree","description":"utility to normalize an nlcst word for easier comparison","archived":false,"fork":false,"pushed_at":"2023-07-17T13:02:31.000Z","size":111,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-26T00:56:58.745Z","etag":null,"topics":["nlcst","nlcst-util","syntax-tree","unist","util"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntax-tree.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2016-01-14T14:08:02.000Z","updated_at":"2023-05-24T15:52:04.000Z","dependencies_parsed_at":"2024-01-14T22:13:43.414Z","dependency_job_id":null,"html_url":"https://github.com/syntax-tree/nlcst-normalize","commit_stats":{"total_commits":87,"total_committers":4,"mean_commits":21.75,"dds":0.03448275862068961,"last_synced_commit":"c5a68843623e44a8c8c249ff53e1b16b2d1b92be"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/syntax-tree/nlcst-normalize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fnlcst-normalize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fnlcst-normalize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fnlcst-normalize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fnlcst-normalize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tree","download_url":"https://codeload.github.com/syntax-tree/nlcst-normalize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fnlcst-normalize/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262560255,"owners_count":23328668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nlcst","nlcst-util","syntax-tree","unist","util"],"created_at":"2024-08-03T00:01:18.180Z","updated_at":"2025-06-29T22:03:40.456Z","avatar_url":"https://github.com/syntax-tree.png","language":"JavaScript","readme":"# nlcst-normalize\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[nlcst][] utility to normalize a word for easier comparison.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`normalize(value[, options])`](#normalizevalue-options)\n    *   [`Options`](#options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis utility serializes a node and cleans it.\n\n## When should I use this?\n\nThis package is a tiny utility that helps when comparing natural language to\nword lists.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install nlcst-normalize\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {normalize} from 'https://esm.sh/nlcst-normalize@4'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {normalize} from 'https://esm.sh/nlcst-normalize@4?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {normalize} from 'nlcst-normalize'\n\nnormalize(\"Don't\") // =\u003e 'dont'\nnormalize('Don’t') // =\u003e 'dont'\nnormalize('Don’t', {allowApostrophes: true}) // =\u003e 'don\\'t'\nnormalize('Block-level') // =\u003e 'blocklevel'\nnormalize('Block-level', {allowDashes: true}) // =\u003e 'block-level'\n\nnormalize({\n  type: 'WordNode',\n  children: [\n    {type: 'TextNode', value: 'Block'},\n    {type: 'PunctuationNode', value: '-'},\n    {type: 'TextNode', value: 'level'}\n  ]\n}) // =\u003e 'blocklevel'\n```\n\n## API\n\nThis package exports the identifier [`normalize`][api-normalize].\nThere is no default export.\n\n### `normalize(value[, options])`\n\nNormalize a word for easier comparison.\n\nAlways normalizes smart apostrophes (`’`) to straight apostrophes (`'`) and\nlowercases alphabetical characters (`[A-Z]`).\n\n###### Parameters\n\n*   `value` ([`Array\u003cNode\u003e`][node], `Node`, or `string`)\n    — word\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nNormalized word (`string`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `allowApostrophes` (`boolean`, default: `false`)\n    — do not strip apostrophes (`'`); the default is to remove apostrophes\n*   `allowDashes` (`boolean`, default: `false`)\n    — Do not strip hyphens (`-`); the default is to remove the hyphen-minus\n    character\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `nlcst-normalize@^4`,\ncompatible with Node.js 16.\n\n## Related\n\n*   [`nlcst-is-literal`](https://github.com/syntax-tree/nlcst-is-literal)\n    — check whether a node is meant literally\n*   [`nlcst-search`](https://github.com/syntax-tree/nlcst-search)\n    — search for patterns\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/syntax-tree/nlcst-normalize/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/nlcst-normalize/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/nlcst-normalize.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/nlcst-normalize\n\n[downloads-badge]: https://img.shields.io/npm/dm/nlcst-normalize.svg\n\n[downloads]: https://www.npmjs.com/package/nlcst-normalize\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=nlcst-normalize\n\n[size]: https://bundlejs.com/?q=nlcst-normalize\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[nlcst]: https://github.com/syntax-tree/nlcst\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[api-normalize]: #normalizevalue-options\n\n[api-options]: #options\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["nlcst utilities"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fnlcst-normalize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tree%2Fnlcst-normalize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fnlcst-normalize/lists"}