Merge pull request #6 from ajlyon/diacritic
Short-circuit removeDiacritics on alphanumeric and other basic input
This commit is contained in:
commit
7a5b1f7e32
1 changed files with 4 additions and 1 deletions
|
@ -671,6 +671,9 @@ Zotero.Utilities = {
|
|||
* From http://lehelk.com/2011/05/06/script-to-remove-diacritics/
|
||||
*/
|
||||
"removeDiacritics": function (str, lowercaseOnly) {
|
||||
// Short-circuit on the most basic input
|
||||
if (/^[a-zA-Z0-9_-]*$/.test(str)) return str;
|
||||
|
||||
var map = this._diacriticsRemovalMap.lowercase;
|
||||
for (var i=0, len=map.length; i<len; i++) {
|
||||
str = str.replace(map[i].letters, map[i].base);
|
||||
|
@ -1296,4 +1299,4 @@ Zotero.Utilities = {
|
|||
//this._cache[item.id] = cslItem;
|
||||
return cslItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue