npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

normalize-strings

v1.1.1

Published

Normalize a string with utf-8 characters.

Downloads

182,321

Readme

Normalize travis

Normalize a string with utf-8 characters.

Usage

Download: normalize.js or normalize.min.js

$npm install normalize-strings --save

or

$bower install normalize-strings --save

Just use the string you want to normalize as argument

console.log(normalize('Åland')) // Aland

You can import it as a commonJS module

var n = require('normalize-strings');

console.log(n('Åland')) // Aland

or as an AMD module

define(['normalize'],
function(n) {
  console.log(n('Åland')) // Aland
});

How it works?

Normalize is based on Django's urlify scrapping character's map from [http://unicode.org/charts/charindex.html]

Why?

JS compares strings according to the utf-8 code of each character. This means, for example, that õ comes after z (i.e. 'õ' > 'z' === true) and this causes disasters when sorting strings. With normalize, you can correctly fix this. Althought you have available String.prototype.localCompare which solve it, it is not yet supported on some browsers (i.e. IE10 and below).

Supported characters in the default charmap

i À Á Â Ã Ä Å Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý à á â ã ä å ç è é ê ë ì í î ï ñ ò ó ô õ ö ø ù ú û ü ý ÿ Ā ā Ă ă Ą ą Ć ć Ĉ ĉ Ċ ċ Č č Ď ď Đ đ Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ĥ ĥ Ħ ħ Ĩ ĩ Ī ī Ĭ ĭ Į į İ Ĵ ĵ Ķ ķ Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł Ń ń Ņ ņ Ň ň Ō ō Ŏ ŏ Ő ő Œ œ Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ŝ ŝ Ş ş Š š Ţ ţ Ť ť Ŧ ŧ Ũ ũ Ū ū Ŭ ŭ Ů ů Ű ű Ų ų Ŵ ŵ Ŷ ŷ Ÿ Ź ź Ż ż Ž ž ƀ Ɓ Ƃ ƃ Ɔ Ƈ ƈ Ɖ Ɗ Ƌ ƌ Ǝ Ɛ Ƒ ƒ Ɠ Ɨ Ƙ ƙ ƚ Ɯ Ɲ ƞ Ɵ Ơ ơ Ƥ ƥ Ʀ ƫ Ƭ ƭ Ʈ Ư ư Ʋ Ƴ ƴ Ƶ ƶ Ǎ ǎ Ǐ ǐ Ǒ ǒ Ǔ ǔ ǝ Ǥ ǥ Ǧ ǧ Ǩ ǩ Ǫ ǫ Ǵ ǵ Ǹ ǹ Ȁ ȁ Ȃ ȃ Ȅ ȅ Ȇ ȇ Ȉ ȉ Ȋ ȋ Ȍ ȍ Ȏ ȏ Ȑ ȑ Ȓ ȓ Ȕ ȕ Ȗ ȗ Ș ș Ț ț Ȟ ȟ Ƞ ȡ Ȥ ȥ Ȧ ȧ Ȩ ȩ Ȯ ȯ Ȳ ȳ ȴ ȵ ȶ ȷ Ⱥ Ȼ ȼ Ƚ Ⱦ ȿ ɀ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ ɐ ɑ ɓ ɔ ɕ ɖ ɗ ɘ ɛ ɜ ɝ ɞ ɟ ɠ ɡ ɢ ɥ ɦ ɨ ɪ ɫ ɬ ɭ ɯ ɰ ɱ ɲ ɳ ɴ ɵ ɹ ɺ ɻ ɼ ɽ ɾ ɿ ʀ ʁ ʂ ʇ ʈ ʉ ʋ ʌ ʍ ʎ ʏ ʐ ʑ ʗ ʙ ʚ ʛ ʜ ʝ ʞ ʟ ʠ ʮ ʰ ʲ ʳ ʴ ʶ ʷ ʸ ˡ ˢ ˣ ̌ ̽ ͓ ͣ ͤ ͥ ͦ ͧ ͨ ͩ ͪ ͫ ͬ ͭ ͮ ͯ ᴀ ᴃ ᴄ ᴅ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ᴐ ᴑ ᴒ ᴓ ᴖ ᴗ ᴘ ᴙ ᴚ ᴛ ᴜ ᴝ ᴞ ᴟ ᴠ ᴡ ᴢ ᵢ ᵣ ᵤ ᵥ Ḁ ḁ Ḃ ḃ Ḅ ḅ Ḇ ḇ Ḋ ḋ Ḍ ḍ Ḏ ḏ Ḑ ḑ Ḓ ḓ Ḙ ḙ Ḛ ḛ Ḟ ḟ Ḡ ḡ Ḣ ḣ Ḥ ḥ Ḧ ḧ Ḩ ḩ Ḫ ḫ Ḭ ḭ Ḱ ḱ Ḳ ḳ Ḵ ḵ Ḷ ḷ Ḻ ḻ Ḽ ḽ Ḿ ḿ Ṁ ṁ Ṃ ṃ Ṅ ṅ Ṇ ṇ Ṉ ṉ Ṋ ṋ Ṕ ṕ Ṗ ṗ Ṙ ṙ Ṛ ṛ Ṟ ṟ Ṡ ṡ Ṣ ṣ Ṫ ṫ Ṭ ṭ Ṯ ṯ Ṱ ṱ Ṳ ṳ Ṵ ṵ Ṷ ṷ Ṽ ṽ Ṿ ṿ Ẁ ẁ Ẃ ẃ Ẅ ẅ Ẇ ẇ Ẉ ẉ Ẋ ẋ Ẍ ẍ Ẏ ẏ Ẑ ẑ Ẓ ẓ Ẕ ẕ ẛ Ạ ạ Ả ả Ẹ ẹ Ẻ ẻ Ẽ ẽ Ỉ ỉ Ị ị Ọ ọ Ỏ ỏ Ụ ụ Ủ ủ Ỳ ỳ Ỵ ỵ Ỷ ỷ Ỹ ỹ ⁱ ₕ ₖ ₗ ₘ ₙ ₚ ₛ ₜ ℂ ℊ ℋ ℌ ℍ ℐ ℑ ℒ ℓ ℔ ℕ ℘ ℙ ℚ ℛ ℜ ℝ ℤ ℨ ℬ ℭ ℯ ℰ ℱ Ⅎ ℳ ℴ ℺ ⅁ ⅂ ⅃ ⅄ ⅅ ⅆ ⅇ ⅈ ⅉ ⅎ Ↄ ↄ ∽ ∾ ⋿ ⌧ ☒ ☰ ⚊ ✕ ✖ ✗ ✘ ⦁ ⦂ Ɫ Ɽ ⱥ ⱦ Ɑ Ɱ Ɐ Ȿ Ɀ ䷀ Ɥ Ɦ Ɜ Ɡ Ɬ Ʞ Ʇ 

Using a custom charmap

You can use your own defined charmap for substitutions providing an object as a second parameter to the normalize function.

normalize('AABB', {
  '97': 'E',
  '98': 'Z'
}); // EEZZ