Normalize Diacritics Versions Save

Normalize diacritics in strings

v2.2.0

5 years ago

Minor code refactoring to check if the JavaScript runtime in which the code executes comes with ICU data installed. If yes, it will use the native method String.prototype.normalize to normalize strings. Without required ICU data, String.prototype.normalize has no effect on the normalization.

In this release, a simple feature detection is added to do that for you and fallbacks when necessary. This is particularly useful for modern JavaScript/ TypeScript runtime such as deno which is built without ICU data.

v1.0.1-deno

5 years ago

v2.0.0

5 years ago

Improved file structure for both the web and Node.js

Notable changes

Leverage file extension that favors each different module system and environment.

  1. Use .mjs for ES Modules on Node.js
import { normalize } from 'normalize-diacritics'; /** Use `index.mjs` */
  1. Use .js for CommonJS on Node.js
const { normalize } = require('normalize-diacritics'); /** Use `index.js` */
  1. Default .js for ES Modules on the web
<script type="module">
  import { normalize } from 'https://unpkg.com/normalize-diacritics@latest/dist/normalize-diacritics.js';
</script>
  1. Use .iife.js for IIFE on the web
<script src="https://unpkg.com/normalize-diacritics@latest/dist/normalize-diacritics.iife.js"></script>
<script>
  const { normalize } = window.NormalizeDiacritics;
</script>

v1.0.0

5 years ago

Notable changes:-

  1. Now ship with multiple bundles:

    a. esm - Targeting native ES modules such as TypeScript. b. cjs - Targeting Node.js with CommonJS. c. iife - Targeting older browsers by compiling to IIFE and ES5.

  2. Fixed a bug where single-character string is not being normalized.

  3. Alternatively, you can rely on third-party services to grab the bundle: unpkg and jsdelivr.

Deno support

It's cool to see this project gaining traction by the community. Because of that, I've decided to add more support for this particular project. It's officially supported as a deno package and is available at awesome-deno where it lists all the deno packages by the community.

Try it now as of today!

import { normalize } from 'https://denopkg.com/motss/[email protected]/index.ts';

(async () => {
  const str = 'söme stüff with áccènts';

  await normalize(str); // 'some stuff with accents'
})();

v0.4.0

6 years ago
  • 💥 A major rewrite of the entire package in TypeScript

  • ✨ : Revised the available methods the package offers, now it comes with async method by default and you can choose to use a sync-version of the method:

    • normalize(input) - Normalizing strings that contains accents/ diacritics via async/ await under the hood.
    • normalizeSync(input) - The synchronous version of the normalization method.

🔥 🔥 🔥Have fun!