{"id":18817878,"url":"https://github.com/vitorluizc/normalize-text","last_synced_at":"2025-04-09T18:16:06.026Z","repository":{"id":28682859,"uuid":"118950298","full_name":"VitorLuizC/normalize-text","owner":"VitorLuizC","description":"📝 Provides a simple functions to normalize texts, whitespaces, paragraphs \u0026 diacritics.","archived":false,"fork":false,"pushed_at":"2025-03-25T12:43:32.000Z","size":728,"stargazers_count":69,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T18:16:00.431Z","etag":null,"topics":["compose","functional-programming","javascript","normalize","normalize-text","string","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/VitorLuizC.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-25T18:19:07.000Z","updated_at":"2025-03-25T00:46:44.000Z","dependencies_parsed_at":"2024-06-18T17:01:10.238Z","dependency_job_id":null,"html_url":"https://github.com/VitorLuizC/normalize-text","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fnormalize-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fnormalize-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fnormalize-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitorLuizC%2Fnormalize-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VitorLuizC","download_url":"https://codeload.github.com/VitorLuizC/normalize-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085322,"owners_count":21045139,"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":["compose","functional-programming","javascript","normalize","normalize-text","string","string-manipulation"],"created_at":"2024-11-08T00:13:48.211Z","updated_at":"2025-04-09T18:16:06.006Z","avatar_url":"https://github.com/VitorLuizC.png","language":"TypeScript","readme":"# Normalize Text\n\n[![Build Status](https://travis-ci.org/VitorLuizC/normalize-text.svg?branch=master)](https://travis-ci.org/VitorLuizC/normalize-text)\n[![License](https://badgen.net/github/license/VitorLuizC/normalize-text)](./LICENSE)\n[![Package tree-shaking](https://badgen.net/bundlephobia/tree-shaking/normalize-text)](https://bundlephobia.com/package/normalize-text)\n[![Package minified \u0026 gzipped size](https://badgen.net/bundlephobia/minzip/normalize-text)](https://bundlephobia.com/package/normalize-text)\n[![Package dependency count](https://badgen.net/bundlephobia/dependency-count/normalize-text)](https://bundlephobia.com/package/normalize-text)\n\nProvides a simple API to normalize texts, white-spaces, names, paragraphs \u0026 diacritics (accents).\n\n- 📦 Distributions in ESM, CommonJS, UMD and UMD _minified_ formats.\n  - Supports NodeJS ESM and CommonJS;\n\n- ⚡ Lightweight:\n  - It's bundled with [Rollup](https://rollupjs.org/) and [Bublé](https://buble.surge.sh/).\n  - Smaller than 1KB (min + gzip).\n  - Supports _tree shaking_.\n\n- 🔋 Bateries included:\n  - Its not based on newer browser's APIs or es2015+ features.\n  - Only needs `String.prototype.normalize` polyfill for older browsers, and don't crashes without it.\n\n- 🏷 Safe:\n  - Type declarations for IDEs and editor's autocomplete/intellisense.\n  - Made with TypeScript as strict as possible.\n  - Unit tests with Jest.\n  - Travis CI that keeps tests running.\n\n## Install\n\n`normalize-text` is published under NPM registry, so you can install using any Node.js package manager.\n\n```sh\nnpm install normalize-text --save\n\n# If you're using Yarn.\nyarn add normalize-text\n```\n\n### Install from CDN\n\nThe bundles of this module are also available on JSDelivr and UNPKG CDNs.\n\nIn both you can import just the bundle you want or use default one, UMD.\n\n```html\n\u003c!-- Using default bundle from JSDelivr --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/normalize-text\"\u003e\u003c/script\u003e\n\n\u003c!-- Using default bundle from UNPKG --\u003e\n\u003cscript src=\"https://unpkg.com/normalize-text\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  /**\n   * UMD bundle expose brazilian-values through `normalizeText` object.\n   */\n  normalizeText.capitalizeFirstLetter('vitor');\n  //=\u003e \"Vitor\"\n\u003c/script\u003e\n```\n\n## Usage\n\nAll the functions are named exported from module.\n\n```js\nimport { normalizeText } from 'normalize-text';\n\nnormalizeText([\n  'Olá\\r\\n',\n  '  como  está a   senhorita?'\n]);\n//=\u003e \"ola como esta a senhorita?\"\n```\n\n## API\n\n### `capitalizeFirstLetter`\n\nCapitalize first character of received text.\n\n```js\ncapitalizeFirstLetter('vitorLuizC');\n//=\u003e \"VitorLuizC\"\n```\n\n### `normalizeDiacritics`\n\nIf `String.prototype.normalize` is supported it normalizes diacritics by replacing them with \"clean\" character from received text.\n\n\u003e It doesn't normalize special characters.\n\n```js\nnormalizeDiacritics('Olá, você aí');\n//=\u003e 'Ola, voce ai'\n\nnormalizeDiacritics('àáãâäéèêëíìîïóòõôöúùûüñçÀÁÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÑÇ');\n//=\u003e \"aaaaaeeeeiiiiooooouuuuncAAAAAEEEEIIIIOOOOOUUUUNC\"\n\nnormalizeDiacritics('@_$\u003e\u003c=-#!,.`\\'\"');\n//=\u003e \"@_$\u003e\u003c=-#!,.`'\\\"\";\n```\n\n### `normalizeName`\n\nNormalize received name by normalizing it's white-spaces and capitalizing first letter of every word but exceptions (received in lower-case).\n\n```js\nnormalizeName(' fernanDA  MONTENEGRO');\n//=\u003e \"Fernanda Montenegro\"\n\nnormalizeName(' wilson da costa', ['da']);\n//=\u003e \"Wilson da Costa\"\n```\n\n### `normalizeParagraph`\n\nNormalize a paragraph by normalizing its white-spaces, capitalizing first letter and adding a period at end.\n\n```js\nnormalizeParagraph(' once upon a time');\n//=\u003e \"Once upon a time.\"\n\nnormalizeParagraph('hello world, my friend\\r\\n');\n// =\u003e 'Hello world, my friend.'\n```\n\n### `normalizeText`\n\nResolve received texts (when receives an `Array`) by normalizing its white-spaces and its diacritics and transforming to lower-case.\n\n```js\nnormalizeText(' so there\\'s  a  Way to NORMALIZE ');\n//=\u003e \"so there\\'s a way to normalize\"\n\nnormalizeText(['Olá\\r\\n', 'como está a   senhorita?']);\n//=\u003e \"ola como esta a senhorita?\"\n```\n\n### `normalizeWhiteSpaces`\n\nNormalize all white-space characters and remove trailing ones received text.\n\n```js\nnormalizeWhiteSpaces(' What exactly is it?   ');\n//=\u003e \"What exactly is it?\"\n\nnormalizeWhiteSpaces('Hi,   how is \\r\\n everything  \\t?');\n//=\u003e 'Hi, how is everything ?'\n\nnormalizeWhiteSpaces`It is ${temperature}\\n  degree\\r outside.  `\n//=\u003e 'It is 25 degree outside.'\n```\n\n## License\n\nReleased under MIT license. You can see it [here](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorluizc%2Fnormalize-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitorluizc%2Fnormalize-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorluizc%2Fnormalize-text/lists"}