mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Bump to v4.15.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash-amd v4.14.2
|
||||
# lodash-amd v4.15.0
|
||||
|
||||
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||
|
||||
@@ -27,4 +27,4 @@ require({
|
||||
});
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.14.2-amd) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.15.0-amd) for more details.
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_baseIndexOf'], function(baseIndexOf) {
|
||||
* specifying an index to search from.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ define([], function() {
|
||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseTimes', './isArguments', './isArray', './_isIndex', './isString'], function(baseTimes, isArguments, isArray, isIndex, isString) {
|
||||
define(['./_baseTimes', './isArguments', './isArray', './_isIndex'], function(baseTimes, isArguments, isArray, isIndex) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
@@ -15,7 +15,9 @@ define(['./_baseTimes', './isArguments', './isArray', './_isIndex', './isString'
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
var result = (isArray(value) || isString(value) || isArguments(value))
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
||||
var result = (isArray(value) || isArguments(value))
|
||||
? baseTimes(value.length, String)
|
||||
: [];
|
||||
|
||||
|
||||
13
_asciiSize.js
Normal file
13
_asciiSize.js
Normal file
@@ -0,0 +1,13 @@
|
||||
define(['./_baseProperty'], function(baseProperty) {
|
||||
|
||||
/**
|
||||
* Gets the size of an ASCII `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
var asciiSize = baseProperty('length');
|
||||
|
||||
return asciiSize;
|
||||
});
|
||||
15
_asciiToArray.js
Normal file
15
_asciiToArray.js
Normal file
@@ -0,0 +1,15 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Converts an ASCII `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function asciiToArray(string) {
|
||||
return string.split('');
|
||||
}
|
||||
|
||||
return asciiToArray;
|
||||
});
|
||||
18
_asciiWords.js
Normal file
18
_asciiWords.js
Normal file
@@ -0,0 +1,18 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to match words composed of alphanumeric characters. */
|
||||
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
||||
|
||||
/**
|
||||
* Splits an ASCII `string` into an array of its words.
|
||||
*
|
||||
* @private
|
||||
* @param {string} The string to inspect.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
*/
|
||||
function asciiWords(string) {
|
||||
return string.match(reAsciiWord) || [];
|
||||
}
|
||||
|
||||
return asciiWords;
|
||||
});
|
||||
@@ -4,7 +4,7 @@ define(['./eq'], function(eq) {
|
||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} key The key to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@ define([], function() {
|
||||
* support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
|
||||
@@ -6,7 +6,7 @@ define([], function() {
|
||||
* using `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
||||
|
||||
@@ -4,7 +4,7 @@ define(['./_baseFindIndex', './_baseIsNaN'], function(baseFindIndex, baseIsNaN)
|
||||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
|
||||
@@ -4,7 +4,7 @@ define([], function() {
|
||||
* This function is like `baseIndexOf` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
|
||||
@@ -10,10 +10,11 @@ define(['./isFunction', './_isHostObject', './_isMasked', './isObject', './_toSo
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
var funcProto = Function.prototype,
|
||||
objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
var funcToString = funcProto.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
@@ -7,7 +7,7 @@ define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject',
|
||||
* The base implementation of `_.set`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to set.
|
||||
* @param {*} value The value to set.
|
||||
* @param {Function} [customizer] The function to customize path creation.
|
||||
|
||||
@@ -4,7 +4,7 @@ define(['./_baseGet', './_baseSet'], function(baseGet, baseSet) {
|
||||
* The base implementation of `_.update`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to update.
|
||||
* @param {Function} updater The function to produce the updated value.
|
||||
* @param {Function} [customizer] The function to customize path creation.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_castSlice', './_reHasComplexSymbol', './_stringToArray', './toString'], function(castSlice, reHasComplexSymbol, stringToArray, toString) {
|
||||
define(['./_castSlice', './_hasUnicode', './_stringToArray', './toString'], function(castSlice, hasUnicode, stringToArray, toString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -14,7 +14,7 @@ define(['./_castSlice', './_reHasComplexSymbol', './_stringToArray', './toString
|
||||
return function(string) {
|
||||
string = toString(string);
|
||||
|
||||
var strSymbols = reHasComplexSymbol.test(string)
|
||||
var strSymbols = hasUnicode(string)
|
||||
? stringToArray(string)
|
||||
: undefined;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseRepeat', './_baseToString', './_castSlice', './_reHasComplexSymbol', './_stringSize', './_stringToArray'], function(baseRepeat, baseToString, castSlice, reHasComplexSymbol, stringSize, stringToArray) {
|
||||
define(['./_baseRepeat', './_baseToString', './_castSlice', './_hasUnicode', './_stringSize', './_stringToArray'], function(baseRepeat, baseToString, castSlice, hasUnicode, stringSize, stringToArray) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -23,7 +23,7 @@ define(['./_baseRepeat', './_baseToString', './_castSlice', './_reHasComplexSymb
|
||||
return charsLength ? baseRepeat(chars, length) : chars;
|
||||
}
|
||||
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
||||
return reHasComplexSymbol.test(chars)
|
||||
return hasUnicode(chars)
|
||||
? castSlice(stringToArray(result), 0, length).join('')
|
||||
: result.slice(0, length);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
define(['./_basePropertyOf'], function(basePropertyOf) {
|
||||
|
||||
/** Used to map latin-1 supplementary letters to basic latin letters. */
|
||||
/** Used to map Latin Unicode letters to basic Latin letters. */
|
||||
var deburredLetters = {
|
||||
// Latin-1 Supplement block.
|
||||
'\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',
|
||||
'\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',
|
||||
@@ -18,11 +19,48 @@ define(['./_basePropertyOf'], function(basePropertyOf) {
|
||||
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
||||
'\xc6': 'Ae', '\xe6': 'ae',
|
||||
'\xde': 'Th', '\xfe': 'th',
|
||||
'\xdf': 'ss'
|
||||
'\xdf': 'ss',
|
||||
// Latin Extended-A block.
|
||||
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
||||
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
||||
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
||||
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
||||
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
||||
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
||||
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
||||
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
||||
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
||||
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
||||
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
||||
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
||||
'\u0134': 'J', '\u0135': 'j',
|
||||
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
||||
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
||||
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
||||
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
||||
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
||||
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
||||
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
||||
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
||||
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
||||
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
||||
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
||||
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
||||
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
||||
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
||||
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
||||
'\u0174': 'W', '\u0175': 'w',
|
||||
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
||||
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
||||
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
||||
'\u0132': 'IJ', '\u0133': 'ij',
|
||||
'\u0152': 'Oe', '\u0153': 'oe',
|
||||
'\u0149': "'n", '\u017f': 'ss'
|
||||
};
|
||||
|
||||
/**
|
||||
* Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
|
||||
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
||||
* letters to basic Latin letters.
|
||||
*
|
||||
* @private
|
||||
* @param {string} letter The matched letter to deburr.
|
||||
|
||||
@@ -39,7 +39,7 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_baseG
|
||||
var getTag = baseGetTag;
|
||||
|
||||
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
||||
// for data views in Edge, and promises in Node.js.
|
||||
// for data views in Edge < 14, and promises in Node.js.
|
||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||
(Map && getTag(new Map) != mapTag) ||
|
||||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString', './_toKey'], function(castPath, isArguments, isArray, isIndex, isKey, isLength, isString, toKey) {
|
||||
define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './_toKey'], function(castPath, isArguments, isArray, isIndex, isKey, isLength, toKey) {
|
||||
|
||||
/**
|
||||
* Checks if `path` exists on `object`.
|
||||
@@ -28,7 +28,7 @@ define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', '
|
||||
}
|
||||
var length = object ? object.length : 0;
|
||||
return !!length && isLength(length) && isIndex(key, length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object));
|
||||
(isArray(object) || isArguments(object));
|
||||
}
|
||||
|
||||
return hasPath;
|
||||
|
||||
@@ -10,7 +10,18 @@ define([], function() {
|
||||
var rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
return reHasComplexSymbol;
|
||||
/**
|
||||
* Checks if `string` contains Unicode symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
||||
*/
|
||||
function hasUnicode(string) {
|
||||
return reHasUnicode.test(string);
|
||||
}
|
||||
|
||||
return hasUnicode;
|
||||
});
|
||||
18
_hasUnicodeWord.js
Normal file
18
_hasUnicodeWord.js
Normal file
@@ -0,0 +1,18 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to detect strings that need a more robust regexp to match words. */
|
||||
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
|
||||
/**
|
||||
* Checks if `string` contains a word composed of Unicode symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
||||
*/
|
||||
function hasUnicodeWord(string) {
|
||||
return reHasUnicodeWord.test(string);
|
||||
}
|
||||
|
||||
return hasUnicodeWord;
|
||||
});
|
||||
@@ -1,30 +1,4 @@
|
||||
define(['./_reHasComplexSymbol'], function(reHasComplexSymbol) {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsAstral = '[' + rsAstralRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
define(['./_asciiSize', './_hasUnicode', './_unicodeSize'], function(asciiSize, hasUnicode, unicodeSize) {
|
||||
|
||||
/**
|
||||
* Gets the number of symbols in `string`.
|
||||
@@ -34,14 +8,9 @@ define(['./_reHasComplexSymbol'], function(reHasComplexSymbol) {
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
function stringSize(string) {
|
||||
if (!(string && reHasComplexSymbol.test(string))) {
|
||||
return string.length;
|
||||
}
|
||||
var result = reComplexSymbol.lastIndex = 0;
|
||||
while (reComplexSymbol.test(string)) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
return hasUnicode(string)
|
||||
? unicodeSize(string)
|
||||
: asciiSize(string);
|
||||
}
|
||||
|
||||
return stringSize;
|
||||
|
||||
@@ -1,30 +1,4 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsAstral = '[' + rsAstralRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
define(['./_asciiToArray', './_hasUnicode', './_unicodeToArray'], function(asciiToArray, hasUnicode, unicodeToArray) {
|
||||
|
||||
/**
|
||||
* Converts `string` to an array.
|
||||
@@ -34,7 +8,9 @@ define([], function() {
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function stringToArray(string) {
|
||||
return string.match(reComplexSymbol);
|
||||
return hasUnicode(string)
|
||||
? unicodeToArray(string)
|
||||
: asciiToArray(string);
|
||||
}
|
||||
|
||||
return stringToArray;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var funcProto = Function.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
var funcToString = funcProto.toString;
|
||||
|
||||
/**
|
||||
* Converts `func` to its source code.
|
||||
|
||||
45
_unicodeSize.js
Normal file
45
_unicodeSize.js
Normal file
@@ -0,0 +1,45 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsAstral = '[' + rsAstralRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
|
||||
/**
|
||||
* Gets the size of a Unicode `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
function unicodeSize(string) {
|
||||
var result = reUnicode.lastIndex = 0;
|
||||
while (reUnicode.test(string)) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return unicodeSize;
|
||||
});
|
||||
41
_unicodeToArray.js
Normal file
41
_unicodeToArray.js
Normal file
@@ -0,0 +1,41 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsAstral = '[' + rsAstralRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
|
||||
/**
|
||||
* Converts a Unicode `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function unicodeToArray(string) {
|
||||
return string.match(reUnicode) || [];
|
||||
}
|
||||
|
||||
return unicodeToArray;
|
||||
});
|
||||
66
_unicodeWords.js
Normal file
66
_unicodeWords.js
Normal file
@@ -0,0 +1,66 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsDingbatRange = '\\u2700-\\u27bf',
|
||||
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
||||
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
||||
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
||||
rsPunctuationRange = '\\u2000-\\u206f',
|
||||
rsSpaceRange = ' \\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',
|
||||
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
||||
rsVarRange = '\\ufe0e\\ufe0f',
|
||||
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsApos = "['\u2019]",
|
||||
rsBreak = '[' + rsBreakRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsDigits = '\\d+',
|
||||
rsDingbat = '[' + rsDingbatRange + ']',
|
||||
rsLower = '[' + rsLowerRange + ']',
|
||||
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsUpper = '[' + rsUpperRange + ']',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||
reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
||||
|
||||
/** Used to match complex or compound words. */
|
||||
var reUnicodeWord = RegExp([
|
||||
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||
rsUpper + '+' + rsOptUpperContr,
|
||||
rsDigits,
|
||||
rsEmoji
|
||||
].join('|'), 'g');
|
||||
|
||||
/**
|
||||
* Splits a Unicode `string` into an array of its words.
|
||||
*
|
||||
* @private
|
||||
* @param {string} The string to inspect.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
*/
|
||||
function unicodeWords(string) {
|
||||
return string.match(reUnicodeWord) || [];
|
||||
}
|
||||
|
||||
return unicodeWords;
|
||||
});
|
||||
11
deburr.js
11
deburr.js
@@ -1,7 +1,7 @@
|
||||
define(['./_deburrLetter', './toString'], function(deburrLetter, toString) {
|
||||
|
||||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
||||
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
@@ -18,8 +18,9 @@ define(['./_deburrLetter', './toString'], function(deburrLetter, toString) {
|
||||
|
||||
/**
|
||||
* Deburrs `string` by converting
|
||||
* [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* to basic latin letters and removing
|
||||
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
||||
* letters to basic Latin letters and removing
|
||||
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
||||
*
|
||||
* @static
|
||||
@@ -35,7 +36,7 @@ define(['./_deburrLetter', './toString'], function(deburrLetter, toString) {
|
||||
*/
|
||||
function deburr(string) {
|
||||
string = toString(string);
|
||||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
|
||||
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
||||
}
|
||||
|
||||
return deburr;
|
||||
|
||||
@@ -10,7 +10,7 @@ define(['./_baseClamp', './_baseToString', './toInteger', './toString'], functio
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to search.
|
||||
* @param {string} [string=''] The string to inspect.
|
||||
* @param {string} [target] The string to search for.
|
||||
* @param {number} [position=string.length] The position to search up to.
|
||||
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
||||
|
||||
2
find.js
2
find.js
@@ -9,7 +9,7 @@ define(['./_createFind', './findIndex'], function(createFind, findIndex) {
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
|
||||
@@ -11,7 +11,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
||||
* @memberOf _
|
||||
* @since 1.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseFindKey', './_baseForOwn', './_baseIteratee'], function(baseFind
|
||||
* @memberOf _
|
||||
* @since 1.1.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to search.
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @returns {string|undefined} Returns the key of the matched element,
|
||||
* else `undefined`.
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_createFind', './findLastIndex'], function(createFind, findLastIndex)
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||||
|
||||
@@ -15,7 +15,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseFindKey', './_baseForOwnRight', './_baseIteratee'], function(bas
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to search.
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @returns {string|undefined} Returns the key of the matched element,
|
||||
* else `undefined`.
|
||||
|
||||
@@ -14,7 +14,7 @@ define(['./_baseIndexOf', './isArrayLike', './isString', './toInteger', './value
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to search.
|
||||
* @param {Array|Object|string} collection The collection to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
||||
|
||||
@@ -13,7 +13,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
|
||||
@@ -38,7 +38,7 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
|
||||
* // => false
|
||||
*/
|
||||
function isArguments(value) {
|
||||
// Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
||||
}
|
||||
|
||||
23
isEmpty.js
23
isEmpty.js
@@ -1,4 +1,4 @@
|
||||
define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer', './isFunction', './isObjectLike', './_isPrototype', './isString', './_nativeKeys'], function(getTag, isArguments, isArray, isArrayLike, isBuffer, isFunction, isObjectLike, isPrototype, isString, nativeKeys) {
|
||||
define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer', './_isPrototype', './_nativeKeys'], function(getTag, isArguments, isArray, isArrayLike, isBuffer, isPrototype, nativeKeys) {
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
@@ -51,24 +51,23 @@ define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer'
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
if (isArrayLike(value) &&
|
||||
(isArray(value) || isString(value) || isFunction(value.splice) ||
|
||||
isArguments(value) || isBuffer(value))) {
|
||||
(isArray(value) || typeof value == 'string' ||
|
||||
typeof value.splice == 'function' || isBuffer(value) || isArguments(value))) {
|
||||
return !value.length;
|
||||
}
|
||||
if (isObjectLike(value)) {
|
||||
var tag = getTag(value);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return !value.size;
|
||||
}
|
||||
var tag = getTag(value);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return !value.size;
|
||||
}
|
||||
if (nonEnumShadows || isPrototype(value)) {
|
||||
return !nativeKeys(value).length;
|
||||
}
|
||||
var isProto = isPrototype(value);
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(nonEnumShadows && nativeKeys(value).length);
|
||||
return true;
|
||||
}
|
||||
|
||||
return isEmpty;
|
||||
|
||||
@@ -33,8 +33,7 @@ define(['./isObject'], function(isObject) {
|
||||
*/
|
||||
function isFunction(value) {
|
||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
||||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
||||
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||
return tag == funcTag || tag == genTag;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
|
||||
var objectTag = '[object Object]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
var funcProto = Function.prototype,
|
||||
objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
var funcToString = funcProto.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
@@ -15,7 +15,7 @@ define(['./_baseFindIndex', './_baseIsNaN', './toInteger'], function(baseFindInd
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
|
||||
315
main.js
315
main.js
@@ -13,7 +13,7 @@
|
||||
var undefined;
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.14.2';
|
||||
var VERSION = '4.15.0';
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
@@ -150,8 +150,8 @@
|
||||
reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
|
||||
reSplitDetails = /,? & /;
|
||||
|
||||
/** Used to match non-compound words composed of alphanumeric characters. */
|
||||
var reBasicWord = /[a-zA-Z0-9]+/g;
|
||||
/** Used to match words composed of alphanumeric characters. */
|
||||
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
||||
|
||||
/** Used to match backslashes in property paths. */
|
||||
var reEscapeChar = /\\(\\)?/g;
|
||||
@@ -183,8 +183,8 @@
|
||||
/** Used to detect unsigned integer values. */
|
||||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
||||
|
||||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
||||
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
||||
|
||||
/** Used to ensure capturing order of template delimiters. */
|
||||
var reNoMatch = /($^)/;
|
||||
@@ -245,10 +245,10 @@
|
||||
var reComboMark = RegExp(rsCombo, 'g');
|
||||
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
|
||||
/** Used to match complex or compound words. */
|
||||
var reComplexWord = RegExp([
|
||||
var reUnicodeWord = RegExp([
|
||||
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||
@@ -258,18 +258,18 @@
|
||||
].join('|'), 'g');
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
/** Used to detect strings that need a more robust regexp to match words. */
|
||||
var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
|
||||
/** Used to assign default `context` object properties. */
|
||||
var contextProps = [
|
||||
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
||||
'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout',
|
||||
'isFinite', 'parseInt', 'setTimeout'
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
||||
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
||||
];
|
||||
|
||||
/** Used to make template sourceURLs easier to identify. */
|
||||
@@ -307,16 +307,17 @@
|
||||
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
||||
cloneableTags[weakMapTag] = false;
|
||||
|
||||
/** Used to map latin-1 supplementary letters to basic latin letters. */
|
||||
/** Used to map Latin Unicode letters to basic Latin letters. */
|
||||
var deburredLetters = {
|
||||
// Latin-1 Supplement block.
|
||||
'\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',
|
||||
'\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',
|
||||
@@ -325,7 +326,43 @@
|
||||
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
||||
'\xc6': 'Ae', '\xe6': 'ae',
|
||||
'\xde': 'Th', '\xfe': 'th',
|
||||
'\xdf': 'ss'
|
||||
'\xdf': 'ss',
|
||||
// Latin Extended-A block.
|
||||
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
||||
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
||||
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
||||
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
||||
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
||||
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
||||
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
||||
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
||||
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
||||
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
||||
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
||||
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
||||
'\u0134': 'J', '\u0135': 'j',
|
||||
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
||||
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
||||
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
||||
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
||||
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
||||
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
||||
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
||||
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
||||
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
||||
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
||||
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
||||
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
||||
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
||||
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
||||
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
||||
'\u0174': 'W', '\u0175': 'w',
|
||||
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
||||
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
||||
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
||||
'\u0132': 'IJ', '\u0133': 'ij',
|
||||
'\u0152': 'Oe', '\u0153': 'oe',
|
||||
'\u0149': "'n", '\u017f': 'ss'
|
||||
};
|
||||
|
||||
/** Used to map characters to HTML entities. */
|
||||
@@ -561,7 +598,7 @@
|
||||
* specifying an index to search from.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
@@ -574,7 +611,7 @@
|
||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
@@ -700,13 +737,44 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size of an ASCII `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
var asciiSize = baseProperty('length');
|
||||
|
||||
/**
|
||||
* Converts an ASCII `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function asciiToArray(string) {
|
||||
return string.split('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an ASCII `string` into an array of its words.
|
||||
*
|
||||
* @private
|
||||
* @param {string} The string to inspect.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
*/
|
||||
function asciiWords(string) {
|
||||
return string.match(reAsciiWord) || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
||||
* without support for iteratee shorthands, which iterates over `collection`
|
||||
* using `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
||||
@@ -727,7 +795,7 @@
|
||||
* support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
@@ -749,7 +817,7 @@
|
||||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
@@ -773,7 +841,7 @@
|
||||
* This function is like `baseIndexOf` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
@@ -1036,7 +1104,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
|
||||
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
||||
* letters to basic Latin letters.
|
||||
*
|
||||
* @private
|
||||
* @param {string} letter The matched letter to deburr.
|
||||
@@ -1076,6 +1145,28 @@
|
||||
return object == null ? undefined : object[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `string` contains Unicode symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
||||
*/
|
||||
function hasUnicode(string) {
|
||||
return reHasUnicode.test(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `string` contains a word composed of Unicode symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
||||
*/
|
||||
function hasUnicodeWord(string) {
|
||||
return reHasUnicodeWord.test(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a host object in IE < 9.
|
||||
*
|
||||
@@ -1210,14 +1301,9 @@
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
function stringSize(string) {
|
||||
if (!(string && reHasComplexSymbol.test(string))) {
|
||||
return string.length;
|
||||
}
|
||||
var result = reComplexSymbol.lastIndex = 0;
|
||||
while (reComplexSymbol.test(string)) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
return hasUnicode(string)
|
||||
? unicodeSize(string)
|
||||
: asciiSize(string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1228,7 +1314,9 @@
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function stringToArray(string) {
|
||||
return string.match(reComplexSymbol);
|
||||
return hasUnicode(string)
|
||||
? unicodeToArray(string)
|
||||
: asciiToArray(string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1240,6 +1328,43 @@
|
||||
*/
|
||||
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
|
||||
|
||||
/**
|
||||
* Gets the size of a Unicode `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
function unicodeSize(string) {
|
||||
var result = reUnicode.lastIndex = 0;
|
||||
while (reUnicode.test(string)) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unicode `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function unicodeToArray(string) {
|
||||
return string.match(reUnicode) || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a Unicode `string` into an array of its words.
|
||||
*
|
||||
* @private
|
||||
* @param {string} The string to inspect.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
*/
|
||||
function unicodeWords(string) {
|
||||
return string.match(reUnicodeWord) || [];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -1279,19 +1404,23 @@
|
||||
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
|
||||
*/
|
||||
function runInContext(context) {
|
||||
context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;
|
||||
context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
|
||||
|
||||
/** Built-in constructor references. */
|
||||
var Array = context.Array,
|
||||
Date = context.Date,
|
||||
Error = context.Error,
|
||||
Function = context.Function,
|
||||
Math = context.Math,
|
||||
Object = context.Object,
|
||||
RegExp = context.RegExp,
|
||||
String = context.String,
|
||||
TypeError = context.TypeError;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var arrayProto = context.Array.prototype,
|
||||
objectProto = context.Object.prototype,
|
||||
stringProto = context.String.prototype;
|
||||
var arrayProto = Array.prototype,
|
||||
funcProto = Function.prototype,
|
||||
objectProto = Object.prototype;
|
||||
|
||||
/** Used to detect overreaching core-js shims. */
|
||||
var coreJsData = context['__core-js_shared__'];
|
||||
@@ -1303,7 +1432,7 @@
|
||||
}());
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = context.Function.prototype.toString;
|
||||
var funcToString = funcProto.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
@@ -1336,14 +1465,14 @@
|
||||
Uint8Array = context.Uint8Array,
|
||||
getPrototype = overArg(Object.getPrototypeOf, Object),
|
||||
iteratorSymbol = Symbol ? Symbol.iterator : undefined,
|
||||
objectCreate = context.Object.create,
|
||||
objectCreate = Object.create,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
splice = arrayProto.splice,
|
||||
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
||||
|
||||
/** Mocked built-ins. */
|
||||
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
|
||||
ctxNow = context.Date && context.Date.now !== root.Date.now && context.Date.now,
|
||||
ctxNow = Date && Date.now !== root.Date.now && Date.now,
|
||||
ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
@@ -1358,9 +1487,7 @@
|
||||
nativeMin = Math.min,
|
||||
nativeParseInt = context.parseInt,
|
||||
nativeRandom = Math.random,
|
||||
nativeReplace = stringProto.replace,
|
||||
nativeReverse = arrayProto.reverse,
|
||||
nativeSplit = stringProto.split;
|
||||
nativeReverse = arrayProto.reverse;
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var DataView = getNative(context, 'DataView'),
|
||||
@@ -1368,11 +1495,11 @@
|
||||
Promise = getNative(context, 'Promise'),
|
||||
Set = getNative(context, 'Set'),
|
||||
WeakMap = getNative(context, 'WeakMap'),
|
||||
nativeCreate = getNative(context.Object, 'create');
|
||||
nativeCreate = getNative(Object, 'create');
|
||||
|
||||
/* Used to set `toString` methods. */
|
||||
var defineProperty = (function() {
|
||||
var func = getNative(context.Object, 'defineProperty'),
|
||||
var func = getNative(Object, 'defineProperty'),
|
||||
name = getNative.name;
|
||||
|
||||
return (name && name.length > 2) ? func : undefined;
|
||||
@@ -2209,7 +2336,9 @@
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
var result = (isArray(value) || isString(value) || isArguments(value))
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
||||
var result = (isArray(value) || isArguments(value))
|
||||
? baseTimes(value.length, String)
|
||||
: [];
|
||||
|
||||
@@ -2281,7 +2410,7 @@
|
||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} key The key to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
@@ -3706,7 +3835,7 @@
|
||||
* The base implementation of `_.set`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to set.
|
||||
* @param {*} value The value to set.
|
||||
* @param {Function} [customizer] The function to customize path creation.
|
||||
@@ -4036,7 +4165,7 @@
|
||||
* The base implementation of `_.update`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to update.
|
||||
* @param {Function} updater The function to produce the updated value.
|
||||
* @param {Function} [customizer] The function to customize path creation.
|
||||
@@ -4647,7 +4776,7 @@
|
||||
return function(string) {
|
||||
string = toString(string);
|
||||
|
||||
var strSymbols = reHasComplexSymbol.test(string)
|
||||
var strSymbols = hasUnicode(string)
|
||||
? stringToArray(string)
|
||||
: undefined;
|
||||
|
||||
@@ -4990,7 +5119,7 @@
|
||||
return charsLength ? baseRepeat(chars, length) : chars;
|
||||
}
|
||||
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
||||
return reHasComplexSymbol.test(chars)
|
||||
return hasUnicode(chars)
|
||||
? castSlice(stringToArray(result), 0, length).join('')
|
||||
: result.slice(0, length);
|
||||
}
|
||||
@@ -5657,7 +5786,7 @@
|
||||
var getTag = baseGetTag;
|
||||
|
||||
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
||||
// for data views in Edge, and promises in Node.js.
|
||||
// for data views in Edge < 14, and promises in Node.js.
|
||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||
(Map && getTag(new Map) != mapTag) ||
|
||||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||||
@@ -5749,7 +5878,7 @@
|
||||
}
|
||||
var length = object ? object.length : 0;
|
||||
return !!length && isLength(length) && isIndex(key, length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object));
|
||||
(isArray(object) || isArguments(object));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6730,7 +6859,7 @@
|
||||
* @memberOf _
|
||||
* @since 1.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
@@ -6778,7 +6907,7 @@
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
@@ -6947,7 +7076,7 @@
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
@@ -7132,7 +7261,7 @@
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
@@ -7510,7 +7639,7 @@
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
@@ -7589,7 +7718,7 @@
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
@@ -8718,7 +8847,7 @@
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
@@ -8756,7 +8885,7 @@
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Function} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||||
@@ -8951,7 +9080,7 @@
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to search.
|
||||
* @param {Array|Object|string} collection The collection to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
||||
@@ -9384,7 +9513,7 @@
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Array|Object|string} collection The collection to inspect.
|
||||
* @returns {number} Returns the collection size.
|
||||
* @example
|
||||
*
|
||||
@@ -9402,14 +9531,11 @@
|
||||
return 0;
|
||||
}
|
||||
if (isArrayLike(collection)) {
|
||||
var result = collection.length;
|
||||
return (result && isString(collection)) ? stringSize(collection) : result;
|
||||
return isString(collection) ? stringSize(collection) : collection.length;
|
||||
}
|
||||
if (isObjectLike(collection)) {
|
||||
var tag = getTag(collection);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
}
|
||||
var tag = getTag(collection);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
}
|
||||
return baseKeys(collection).length;
|
||||
}
|
||||
@@ -10818,7 +10944,7 @@
|
||||
* // => false
|
||||
*/
|
||||
function isArguments(value) {
|
||||
// Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
||||
}
|
||||
@@ -11041,24 +11167,23 @@
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
if (isArrayLike(value) &&
|
||||
(isArray(value) || isString(value) || isFunction(value.splice) ||
|
||||
isArguments(value) || isBuffer(value))) {
|
||||
(isArray(value) || typeof value == 'string' ||
|
||||
typeof value.splice == 'function' || isBuffer(value) || isArguments(value))) {
|
||||
return !value.length;
|
||||
}
|
||||
if (isObjectLike(value)) {
|
||||
var tag = getTag(value);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return !value.size;
|
||||
}
|
||||
var tag = getTag(value);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return !value.size;
|
||||
}
|
||||
if (nonEnumShadows || isPrototype(value)) {
|
||||
return !nativeKeys(value).length;
|
||||
}
|
||||
var isProto = isPrototype(value);
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(nonEnumShadows && nativeKeys(value).length);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11206,8 +11331,7 @@
|
||||
*/
|
||||
function isFunction(value) {
|
||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
||||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
||||
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||
return tag == funcTag || tag == genTag;
|
||||
}
|
||||
@@ -12021,7 +12145,7 @@
|
||||
return NAN;
|
||||
}
|
||||
if (isObject(value)) {
|
||||
var other = isFunction(value.valueOf) ? value.valueOf() : value;
|
||||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||||
value = isObject(other) ? (other + '') : other;
|
||||
}
|
||||
if (typeof value != 'string') {
|
||||
@@ -12379,7 +12503,7 @@
|
||||
* @memberOf _
|
||||
* @since 1.1.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to search.
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @returns {string|undefined} Returns the key of the matched element,
|
||||
* else `undefined`.
|
||||
@@ -12418,7 +12542,7 @@
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to search.
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @returns {string|undefined} Returns the key of the matched element,
|
||||
* else `undefined`.
|
||||
@@ -13660,8 +13784,9 @@
|
||||
|
||||
/**
|
||||
* Deburrs `string` by converting
|
||||
* [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* to basic latin letters and removing
|
||||
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
||||
* letters to basic Latin letters and removing
|
||||
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
||||
*
|
||||
* @static
|
||||
@@ -13677,7 +13802,7 @@
|
||||
*/
|
||||
function deburr(string) {
|
||||
string = toString(string);
|
||||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
|
||||
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13687,7 +13812,7 @@
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to search.
|
||||
* @param {string} [string=''] The string to inspect.
|
||||
* @param {string} [target] The string to search for.
|
||||
* @param {number} [position=string.length] The position to search up to.
|
||||
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
||||
@@ -14043,7 +14168,7 @@
|
||||
var args = arguments,
|
||||
string = toString(args[0]);
|
||||
|
||||
return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
|
||||
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14104,11 +14229,11 @@
|
||||
(separator != null && !isRegExp(separator))
|
||||
)) {
|
||||
separator = baseToString(separator);
|
||||
if (separator == '' && reHasComplexSymbol.test(string)) {
|
||||
if (!separator && hasUnicode(string)) {
|
||||
return castSlice(stringToArray(string), 0, limit);
|
||||
}
|
||||
}
|
||||
return nativeSplit.call(string, separator, limit);
|
||||
return string.split(separator, limit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14143,7 +14268,7 @@
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to search.
|
||||
* @param {string} [string=''] The string to inspect.
|
||||
* @param {string} [target] The string to search for.
|
||||
* @param {number} [position=0] The position to search from.
|
||||
* @returns {boolean} Returns `true` if `string` starts with `target`,
|
||||
@@ -14580,7 +14705,7 @@
|
||||
string = toString(string);
|
||||
|
||||
var strLength = string.length;
|
||||
if (reHasComplexSymbol.test(string)) {
|
||||
if (hasUnicode(string)) {
|
||||
var strSymbols = stringToArray(string);
|
||||
strLength = strSymbols.length;
|
||||
}
|
||||
@@ -14717,7 +14842,7 @@
|
||||
pattern = guard ? undefined : pattern;
|
||||
|
||||
if (pattern === undefined) {
|
||||
pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;
|
||||
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
||||
}
|
||||
return string.match(pattern) || [];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-amd",
|
||||
"version": "4.14.2",
|
||||
"version": "4.15.0",
|
||||
"description": "Lodash exported as AMD modules.",
|
||||
"keywords": "amd, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
define(['./toString'], function(toString) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var stringProto = String.prototype;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeReplace = stringProto.replace;
|
||||
|
||||
/**
|
||||
* Replaces matches for `pattern` in `string` with `replacement`.
|
||||
*
|
||||
@@ -29,7 +23,7 @@ define(['./toString'], function(toString) {
|
||||
var args = arguments,
|
||||
string = toString(args[0]);
|
||||
|
||||
return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
|
||||
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
||||
}
|
||||
|
||||
return replace;
|
||||
|
||||
15
size.js
15
size.js
@@ -1,4 +1,4 @@
|
||||
define(['./_baseKeys', './_getTag', './isArrayLike', './isObjectLike', './isString', './_stringSize'], function(baseKeys, getTag, isArrayLike, isObjectLike, isString, stringSize) {
|
||||
define(['./_baseKeys', './_getTag', './isArrayLike', './isString', './_stringSize'], function(baseKeys, getTag, isArrayLike, isString, stringSize) {
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
@@ -12,7 +12,7 @@ define(['./_baseKeys', './_getTag', './isArrayLike', './isObjectLike', './isStri
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to inspect.
|
||||
* @param {Array|Object|string} collection The collection to inspect.
|
||||
* @returns {number} Returns the collection size.
|
||||
* @example
|
||||
*
|
||||
@@ -30,14 +30,11 @@ define(['./_baseKeys', './_getTag', './isArrayLike', './isObjectLike', './isStri
|
||||
return 0;
|
||||
}
|
||||
if (isArrayLike(collection)) {
|
||||
var result = collection.length;
|
||||
return (result && isString(collection)) ? stringSize(collection) : result;
|
||||
return isString(collection) ? stringSize(collection) : collection.length;
|
||||
}
|
||||
if (isObjectLike(collection)) {
|
||||
var tag = getTag(collection);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
}
|
||||
var tag = getTag(collection);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
}
|
||||
return baseKeys(collection).length;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
|
||||
12
split.js
12
split.js
@@ -1,4 +1,4 @@
|
||||
define(['./_baseToString', './_castSlice', './_isIterateeCall', './isRegExp', './_reHasComplexSymbol', './_stringToArray', './toString'], function(baseToString, castSlice, isIterateeCall, isRegExp, reHasComplexSymbol, stringToArray, toString) {
|
||||
define(['./_baseToString', './_castSlice', './_hasUnicode', './_isIterateeCall', './isRegExp', './_stringToArray', './toString'], function(baseToString, castSlice, hasUnicode, isIterateeCall, isRegExp, stringToArray, toString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -6,12 +6,6 @@ define(['./_baseToString', './_castSlice', './_isIterateeCall', './isRegExp', '.
|
||||
/** Used as references for the maximum length and index of an array. */
|
||||
var MAX_ARRAY_LENGTH = 4294967295;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var stringProto = String.prototype;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeSplit = stringProto.split;
|
||||
|
||||
/**
|
||||
* Splits `string` by `separator`.
|
||||
*
|
||||
@@ -45,11 +39,11 @@ define(['./_baseToString', './_castSlice', './_isIterateeCall', './isRegExp', '.
|
||||
(separator != null && !isRegExp(separator))
|
||||
)) {
|
||||
separator = baseToString(separator);
|
||||
if (separator == '' && reHasComplexSymbol.test(string)) {
|
||||
if (!separator && hasUnicode(string)) {
|
||||
return castSlice(stringToArray(string), 0, limit);
|
||||
}
|
||||
}
|
||||
return nativeSplit.call(string, separator, limit);
|
||||
return string.split(separator, limit);
|
||||
}
|
||||
|
||||
return split;
|
||||
|
||||
@@ -7,7 +7,7 @@ define(['./_baseClamp', './_baseToString', './toInteger', './toString'], functio
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to search.
|
||||
* @param {string} [string=''] The string to inspect.
|
||||
* @param {string} [target] The string to search for.
|
||||
* @param {number} [position=0] The position to search from.
|
||||
* @returns {boolean} Returns `true` if `string` starts with `target`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./isFunction', './isObject', './isSymbol'], function(isFunction, isObject, isSymbol) {
|
||||
define(['./isObject', './isSymbol'], function(isObject, isSymbol) {
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var NAN = 0 / 0;
|
||||
@@ -49,7 +49,7 @@ define(['./isFunction', './isObject', './isSymbol'], function(isFunction, isObje
|
||||
return NAN;
|
||||
}
|
||||
if (isObject(value)) {
|
||||
var other = isFunction(value.valueOf) ? value.valueOf() : value;
|
||||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||||
value = isObject(other) ? (other + '') : other;
|
||||
}
|
||||
if (typeof value != 'string') {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseToString', './_castSlice', './isObject', './isRegExp', './_reHasComplexSymbol', './_stringSize', './_stringToArray', './toInteger', './toString'], function(baseToString, castSlice, isObject, isRegExp, reHasComplexSymbol, stringSize, stringToArray, toInteger, toString) {
|
||||
define(['./_baseToString', './_castSlice', './_hasUnicode', './isObject', './isRegExp', './_stringSize', './_stringToArray', './toInteger', './toString'], function(baseToString, castSlice, hasUnicode, isObject, isRegExp, stringSize, stringToArray, toInteger, toString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -59,7 +59,7 @@ define(['./_baseToString', './_castSlice', './isObject', './isRegExp', './_reHas
|
||||
string = toString(string);
|
||||
|
||||
var strLength = string.length;
|
||||
if (reHasComplexSymbol.test(string)) {
|
||||
if (hasUnicode(string)) {
|
||||
var strSymbols = stringToArray(string);
|
||||
strLength = strSymbols.length;
|
||||
}
|
||||
|
||||
61
words.js
61
words.js
@@ -1,65 +1,8 @@
|
||||
define(['./toString'], function(toString) {
|
||||
define(['./_asciiWords', './_hasUnicodeWord', './toString', './_unicodeWords'], function(asciiWords, hasUnicodeWord, toString, unicodeWords) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to match non-compound words composed of alphanumeric characters. */
|
||||
var reBasicWord = /[a-zA-Z0-9]+/g;
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsDingbatRange = '\\u2700-\\u27bf',
|
||||
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
||||
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
||||
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
||||
rsPunctuationRange = '\\u2000-\\u206f',
|
||||
rsSpaceRange = ' \\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',
|
||||
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
||||
rsVarRange = '\\ufe0e\\ufe0f',
|
||||
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsApos = "['\u2019]",
|
||||
rsBreak = '[' + rsBreakRange + ']',
|
||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||
rsDigits = '\\d+',
|
||||
rsDingbat = '[' + rsDingbatRange + ']',
|
||||
rsLower = '[' + rsLowerRange + ']',
|
||||
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||
rsUpper = '[' + rsUpperRange + ']',
|
||||
rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to compose unicode regexes. */
|
||||
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||
reOptMod = rsModifier + '?',
|
||||
rsOptVar = '[' + rsVarRange + ']?',
|
||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
||||
|
||||
/** Used to match complex or compound words. */
|
||||
var reComplexWord = RegExp([
|
||||
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||
rsUpper + '+' + rsOptUpperContr,
|
||||
rsDigits,
|
||||
rsEmoji
|
||||
].join('|'), 'g');
|
||||
|
||||
/** Used to detect strings that need a more robust regexp to match words. */
|
||||
var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||
|
||||
/**
|
||||
* Splits `string` into an array of its words.
|
||||
*
|
||||
@@ -84,7 +27,7 @@ define(['./toString'], function(toString) {
|
||||
pattern = guard ? undefined : pattern;
|
||||
|
||||
if (pattern === undefined) {
|
||||
pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;
|
||||
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
||||
}
|
||||
return string.match(pattern) || [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user