Make _.deburr handle combining diacritical marks. [closes #1070]

This commit is contained in:
jdalton
2015-03-23 20:50:04 -07:00
parent 763b003a11
commit 9d79cc7e87
2 changed files with 35 additions and 1 deletions

View File

@@ -87,6 +87,13 @@
reEvaluate = /<%([\s\S]+?)%>/g,
reInterpolate = /<%=([\s\S]+?)%>/g;
/**
* Used to match combining diacritical marks.
* See [Wikipedia](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks)
* for more details.
*/
var reComboMarks = /[\u0300-\u036f\ufe20-\ufe23]/g;
/**
* Used to match ES template delimiters.
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
@@ -10073,7 +10080,7 @@
*/
function deburr(string) {
string = baseToString(string);
return string && string.replace(reLatin1, deburrLetter);
return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, '');
}
/**