Releases: motss/normalize-diacritics
v2.2.0
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.
v2.0.0
Improved file structure for both the web and Node.js
Notable changes
Leverage file extension that favors each different module system and environment.
- Use
.mjs
for ES Modules on Node.js
import { normalize } from 'normalize-diacritics'; /** Use `index.mjs` */
- Use
.js
for CommonJS on Node.js
const { normalize } = require('normalize-diacritics'); /** Use `index.js` */
- 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>
- 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.1-deno
🔖 v1.0.1-deno
🎉 v1.0.0 stable release
Notable changes:-
-
Now ship with multiple bundles:
a.
esm
- Targeting native ES modules such as TypeScript.
b.cjs
- TargetingNode.js
withCommonJS
.
c.iife
- Targeting older browsers by compiling toIIFE
andES5
. -
Fixed a bug where single-character string is not being normalized.
-
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/normalize-diacritics@v1.0.0-deno/index.ts';
(async () => {
const str = 'söme stüff with áccènts';
await normalize(str); // 'some stuff with accents'
})();
Now in TypeScript with new features
-
💥 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 viaasync/ await
under the hood.normalizeSync(input)
- The synchronous version of the normalization method.
🔥 🔥 🔥Have fun!