Files
lodash/string/deburr.js
John-David Dalton 9b7c4d6761 Bump to v3.0.0.
2015-05-19 22:25:55 -07:00

28 lines
865 B
JavaScript

define(['../internal/baseToString', '../internal/deburrLetter'], function(baseToString, deburrLetter) {
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/**
* Deburrs `string` by converting latin-1 supplementary letters to basic latin letters.
* See [Wikipedia](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* for more details.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = baseToString(string);
return string && string.replace(reLatin1, deburrLetter);
}
return deburr;
});