normalize-diacritics
Remove accents/ diacritics in string
!Follow mefollow-me-badgefollow-me-url
!Versionversion-badgeversion-url !Node versionnode-version-badgenode-version-url !MIT Licensemit-license-badgemit-license-url
!Downloadsdownloads-badgedownloads-url !Total downloadstotal-downloads-badgedownloads-url !Packagephobiapackagephobia-badgepackagephobia-url !Bundlephobiabundlephobia-badgebundlephobia-url
!ciga-badgega-url !codecovcodecov-badgecodecov-url
!Code of Conductcoc-badgecoc-url
Simple NPMnpm-url package to remove any accents/ diacritics found in a string.
Table of contents
- TypeScript or ES Modules - Browser - normalize(input) - normalizeSync(input) - Code of ConductPre-requisite
- Node.jsnode-js-url >= 14.17.3
- NPMnpm-url >= 6.14.13 (NPMnpm-url comes with Node.jsnode-js-url so there is no need to install separately.)
- ES Modules
Install
# Install via NPM
$ npm i normalize-diacritics
Usage
TypeScript or ES Modules
import { normalize } from 'normalize-diacritics';
/** Assuming top-level await is enabled... */
await normalize('söme stüff with áccènts'); // 'some stuff with accents'
Browser
<script type="module">
import { normalize } from 'https://cdn.skypack.dev/normalize-diacritics@latest';
// --snip
</script>
Demo
deno
👉 Check out the deno module at denomod/normalizediacritics.API Reference
normalize(input)
input
stringstring-mdn-url> Optional input string that contains accents/ diacritics.- returns: <Promisepromise-mdn-url<stringstring-mdn-url>> Promise which resolves with normalized input string.
This method normalizes any accents/ diacritics found in a given input string and output a normalized string as a result.
normalizeSync(input)
This methods works the same asnormalize([input])
except that this is the synchronous version.