Normalize diacritics in strings
MIT License
Bot releases are hidden (Show)
Full Changelog: https://github.com/motss/normalize-diacritics/compare/v4.0.3...v5.0.0
Published by motss about 1 year ago
Full Changelog: https://github.com/motss/normalize-diacritics/compare/v4.0.2...v4.0.3
Published by motss almost 2 years ago
This marks the first release of supporting moduleResolution: NodeNext
in TypeScript and the similar in Node.js which bring native ES Modules outside of the web, notably changes includes:
.js
;⚠️ If you find this version does not work for you, you can instead downgrade to v3
until you are ready to adopt moduleResolution: NodeNext
in TypeScript and the similar in Node.js.
Full Changelog: https://github.com/motss/normalize-diacritics/compare/v3.0.10...v4.0.0
Published by motss almost 2 years ago
This marks the last release of v3
as the next major version will only support the latest module resolution in Node.js and TypeScript aka NodeNext
which is closer to the native ES Modules on the web.
import
and exports
mapFull Changelog: https://github.com/motss/normalize-diacritics/compare/v3.0.8...v3.0.12
Published by motss over 2 years ago
Published by motss about 3 years ago
Published by motss over 3 years ago
exports
in package.json to support both CommonJS and ES Modules for node@14
and abovePublished by motss about 4 years ago
Published by motss over 5 years ago
RegExp
instance for normalization, due to a bug reported in #112 which was caused by reusing the same RegExp
instance will cause its internal lastIndex
state to be incremented and not reset thus failing subsequent matching character in the same string to produce false
when calling .test()
method.Published by motss over 5 years ago
IIFE
in favor of UMD
bundleRollup
config file to build UMD
bundlerm -rf
Contributing
section and new demo buttonPublished by motss over 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.
Published by motss over 5 years ago
Leverage file extension that favors each different module system and environment.
.mjs
for ES Modules on Node.jsimport { normalize } from 'normalize-diacritics'; /** Use `index.mjs` */
.js
for CommonJS on Node.jsconst { normalize } = require('normalize-diacritics'); /** Use `index.js` */
.js
for ES Modules on the web<script type="module">
import { normalize } from 'https://unpkg.com/normalize-diacritics@latest/dist/normalize-diacritics.js';
</script>
.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>
Published by motss almost 6 years ago
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
.
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.
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'
})();
Published by motss almost 7 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!