diacritics
Advanced tools
Comparing version 1.0.1 to 1.0.2
12
index.js
@@ -281,6 +281,12 @@ var DIACRITICS_REMOVAL_MAP = [ | ||
var ALL_ASCII_REGEX = /^[\x00-\x7f]*$/; | ||
exports.remove = function (str) { | ||
var i, removal; | ||
for (i = 0; i < MAP_LENGTH; ++i) { | ||
removal = DIACRITICS_REMOVAL_MAP[i]; | ||
if (ALL_ASCII_REGEX.test(str)) { | ||
// this code path is roughly 15x faster (at the time of writing), | ||
// and it is the common case. | ||
return str; | ||
} | ||
for (var i = 0; i < MAP_LENGTH; ++i) { | ||
var removal = DIACRITICS_REMOVAL_MAP[i]; | ||
str = str.replace(removal.regex, removal.base); | ||
@@ -287,0 +293,0 @@ } |
{ | ||
"name": "diacritics", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "remove diacritics from strings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11523
323