mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Make unicode chars lower case.
This commit is contained in:
44
lodash.js
44
lodash.js
@@ -80,7 +80,7 @@
|
||||
var reHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used to match latin-1 supplement letters (excluding mathematical operators) */
|
||||
var reLatin1 = /[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g;
|
||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
|
||||
/** Used to ensure capturing order of template delimiters */
|
||||
var reNoMatch = /($^)/;
|
||||
@@ -100,8 +100,8 @@
|
||||
|
||||
/** Used to match words to create compound words */
|
||||
var reWords = (function() {
|
||||
var upper = '[A-Z\\xC0-\\xD6\\xD8-\\xDE]',
|
||||
lower = '[a-z\\xDF-\\xF6\\xF8-\\xFF]+';
|
||||
var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
|
||||
lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
|
||||
|
||||
return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
|
||||
}());
|
||||
@@ -109,13 +109,13 @@
|
||||
/** Used to detect and test whitespace */
|
||||
var whitespace = (
|
||||
// whitespace
|
||||
' \t\x0B\f\xA0\ufeff' +
|
||||
' \t\x0b\f\xa0\ufeff' +
|
||||
|
||||
// line terminators
|
||||
'\n\r\u2028\u2029' +
|
||||
|
||||
// unicode category "Zs" space separators
|
||||
'\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
||||
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
||||
);
|
||||
|
||||
/** Used to assign default `context` object properties */
|
||||
@@ -202,23 +202,23 @@
|
||||
|
||||
/** Used to map latin-1 supplementary letters to basic latin letters */
|
||||
var deburredLetters = {
|
||||
'\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A',
|
||||
'\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a',
|
||||
'\xC7': 'C', '\xE7': 'c',
|
||||
'\xD0': 'D', '\xF0': 'd',
|
||||
'\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E',
|
||||
'\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e',
|
||||
'\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I',
|
||||
'\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i',
|
||||
'\xD1': 'N', '\xF1': 'n',
|
||||
'\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O',
|
||||
'\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o',
|
||||
'\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U',
|
||||
'\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u',
|
||||
'\xDD': 'Y', '\xFD': 'y', '\xFF': 'y',
|
||||
'\xC6': 'Ae', '\xE6': 'ae',
|
||||
'\xDE': 'Th', '\xFE': 'th',
|
||||
'\xDF': 'ss'
|
||||
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
||||
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
||||
'\xc7': 'C', '\xe7': 'c',
|
||||
'\xd0': 'D', '\xf0': 'd',
|
||||
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
||||
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
||||
'\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
||||
'\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
||||
'\xd1': 'N', '\xf1': 'n',
|
||||
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
||||
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
||||
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
||||
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
||||
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
||||
'\xc6': 'Ae', '\xe6': 'ae',
|
||||
'\xde': 'Th', '\xfe': 'th',
|
||||
'\xdf': 'ss'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
16
test/test.js
16
test/test.js
@@ -219,10 +219,10 @@
|
||||
|
||||
/** List of latin-1 supplementary letters to basic latin letters */
|
||||
var burredLetters = [
|
||||
'\xC0', '\xC1', '\xC2', '\xC3', '\xC4', '\xC5', '\xC6', '\xC7', '\xC8', '\xC9', '\xCA', '\xCB', '\xCC', '\xCD', '\xCE',
|
||||
'\xCF', '\xD0', '\xD1', '\xD2', '\xD3', '\xD4', '\xD5', '\xD6', '\xD8', '\xD9', '\xDA', '\xDB', '\xDC', '\xDD', '\xDE',
|
||||
'\xDF', '\xE0', '\xE1', '\xE2', '\xE3', '\xE4', '\xE5', '\xE6', '\xE7', '\xE8', '\xE9', '\xEA', '\xEB', '\xEC', '\xED', '\xEE',
|
||||
'\xEF', '\xF0', '\xF1', '\xF2', '\xF3', '\xF4', '\xF5', '\xF6', '\xF8', '\xF9', '\xFA', '\xFB', '\xFC', '\xFD', '\xFE', '\xFF'
|
||||
'\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce',
|
||||
'\xcf', '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde',
|
||||
'\xdf', '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee',
|
||||
'\xef', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
|
||||
];
|
||||
|
||||
/** List of `burredLetters` translated to basic latin letters */
|
||||
@@ -281,7 +281,7 @@
|
||||
* Used to check for problems removing whitespace. For a whitespace reference
|
||||
* see V8's unit test https://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/whitespaces.js.
|
||||
*/
|
||||
var whitespace = ' \t\x0B\f\xA0\ufeff\n\r\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
|
||||
var whitespace = ' \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
|
||||
|
||||
/**
|
||||
* Extracts the unwrapped value from its wrapper.
|
||||
@@ -1429,7 +1429,7 @@
|
||||
});
|
||||
|
||||
test('should trim latin-1 mathematical operators', 1, function() {
|
||||
var actual = _.map(['\xD7', '\xF7'], func);
|
||||
var actual = _.map(['\xd7', '\xf7'], func);
|
||||
deepEqual(actual, ['', '']);
|
||||
});
|
||||
|
||||
@@ -2948,7 +2948,7 @@
|
||||
});
|
||||
|
||||
test('should not deburr latin-1 mathematical operators', 1, function() {
|
||||
var operators = ['\xD7', '\xF7'],
|
||||
var operators = ['\xd7', '\xf7'],
|
||||
actual = _.map(operators, _.deburr);
|
||||
|
||||
deepEqual(actual, operators);
|
||||
@@ -12492,7 +12492,7 @@
|
||||
});
|
||||
|
||||
test('should not treat mathematical operators as words', 1, function() {
|
||||
var operators = ['\xD7', '\xF7'],
|
||||
var operators = ['\xd7', '\xf7'],
|
||||
expected = _.map(operators, _.constant([])),
|
||||
actual = _.map(operators, _.words);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user