lodash-rails 4.14.1 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@
12
12
  var undefined;
13
13
 
14
14
  /** Used as the semantic version number. */
15
- var VERSION = '4.14.1';
15
+ var VERSION = '4.15.0';
16
16
 
17
17
  /** Used as the size to enable large array optimizations. */
18
18
  var LARGE_ARRAY_SIZE = 200;
@@ -134,7 +134,7 @@
134
134
 
135
135
  /**
136
136
  * Used to match `RegExp`
137
- * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
137
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
138
138
  */
139
139
  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
140
140
  reHasRegExpChar = RegExp(reRegExpChar.source);
@@ -149,15 +149,15 @@
149
149
  reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
150
150
  reSplitDetails = /,? & /;
151
151
 
152
- /** Used to match non-compound words composed of alphanumeric characters. */
153
- var reBasicWord = /[a-zA-Z0-9]+/g;
152
+ /** Used to match words composed of alphanumeric characters. */
153
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
154
154
 
155
155
  /** Used to match backslashes in property paths. */
156
156
  var reEscapeChar = /\\(\\)?/g;
157
157
 
158
158
  /**
159
159
  * Used to match
160
- * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
160
+ * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
161
161
  */
162
162
  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
163
163
 
@@ -182,8 +182,8 @@
182
182
  /** Used to detect unsigned integer values. */
183
183
  var reIsUint = /^(?:0|[1-9]\d*)$/;
184
184
 
185
- /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
186
- var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
185
+ /** Used to match Latin Unicode letters (excluding mathematical operators). */
186
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
187
187
 
188
188
  /** Used to ensure capturing order of template delimiters. */
189
189
  var reNoMatch = /($^)/;
@@ -244,10 +244,10 @@
244
244
  var reComboMark = RegExp(rsCombo, 'g');
245
245
 
246
246
  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
247
- var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
247
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
248
248
 
249
249
  /** Used to match complex or compound words. */
250
- var reComplexWord = RegExp([
250
+ var reUnicodeWord = RegExp([
251
251
  rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
252
252
  rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
253
253
  rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
@@ -257,17 +257,17 @@
257
257
  ].join('|'), 'g');
258
258
 
259
259
  /** 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/). */
260
- var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
260
+ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
261
261
 
262
262
  /** Used to detect strings that need a more robust regexp to match words. */
263
- 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 ]/;
263
+ 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 ]/;
264
264
 
265
265
  /** Used to assign default `context` object properties. */
266
266
  var contextProps = [
267
267
  'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
268
268
  'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
269
- 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
270
- 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
269
+ 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
270
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
271
271
  '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
272
272
  ];
273
273
 
@@ -306,16 +306,17 @@
306
306
  cloneableTags[errorTag] = cloneableTags[funcTag] =
307
307
  cloneableTags[weakMapTag] = false;
308
308
 
309
- /** Used to map latin-1 supplementary letters to basic latin letters. */
309
+ /** Used to map Latin Unicode letters to basic Latin letters. */
310
310
  var deburredLetters = {
311
+ // Latin-1 Supplement block.
311
312
  '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
312
313
  '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
313
314
  '\xc7': 'C', '\xe7': 'c',
314
315
  '\xd0': 'D', '\xf0': 'd',
315
316
  '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
316
317
  '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
317
- '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
318
- '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
318
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
319
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
319
320
  '\xd1': 'N', '\xf1': 'n',
320
321
  '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
321
322
  '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
@@ -324,7 +325,43 @@
324
325
  '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
325
326
  '\xc6': 'Ae', '\xe6': 'ae',
326
327
  '\xde': 'Th', '\xfe': 'th',
327
- '\xdf': 'ss'
328
+ '\xdf': 'ss',
329
+ // Latin Extended-A block.
330
+ '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
331
+ '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
332
+ '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
333
+ '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
334
+ '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
335
+ '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
336
+ '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
337
+ '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
338
+ '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
339
+ '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
340
+ '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
341
+ '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
342
+ '\u0134': 'J', '\u0135': 'j',
343
+ '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
344
+ '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
345
+ '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
346
+ '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
347
+ '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
348
+ '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
349
+ '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
350
+ '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
351
+ '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
352
+ '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
353
+ '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
354
+ '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
355
+ '\u0163': 't', '\u0165': 't', '\u0167': 't',
356
+ '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
357
+ '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
358
+ '\u0174': 'W', '\u0175': 'w',
359
+ '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
360
+ '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
361
+ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
362
+ '\u0132': 'IJ', '\u0133': 'ij',
363
+ '\u0152': 'Oe', '\u0153': 'oe',
364
+ '\u0149': "'n", '\u017f': 'ss'
328
365
  };
329
366
 
330
367
  /** Used to map characters to HTML entities. */
@@ -560,7 +597,7 @@
560
597
  * specifying an index to search from.
561
598
  *
562
599
  * @private
563
- * @param {Array} [array] The array to search.
600
+ * @param {Array} [array] The array to inspect.
564
601
  * @param {*} target The value to search for.
565
602
  * @returns {boolean} Returns `true` if `target` is found, else `false`.
566
603
  */
@@ -573,7 +610,7 @@
573
610
  * This function is like `arrayIncludes` except that it accepts a comparator.
574
611
  *
575
612
  * @private
576
- * @param {Array} [array] The array to search.
613
+ * @param {Array} [array] The array to inspect.
577
614
  * @param {*} target The value to search for.
578
615
  * @param {Function} comparator The comparator invoked per element.
579
616
  * @returns {boolean} Returns `true` if `target` is found, else `false`.
@@ -699,13 +736,44 @@
699
736
  return false;
700
737
  }
701
738
 
739
+ /**
740
+ * Gets the size of an ASCII `string`.
741
+ *
742
+ * @private
743
+ * @param {string} string The string inspect.
744
+ * @returns {number} Returns the string size.
745
+ */
746
+ var asciiSize = baseProperty('length');
747
+
748
+ /**
749
+ * Converts an ASCII `string` to an array.
750
+ *
751
+ * @private
752
+ * @param {string} string The string to convert.
753
+ * @returns {Array} Returns the converted array.
754
+ */
755
+ function asciiToArray(string) {
756
+ return string.split('');
757
+ }
758
+
759
+ /**
760
+ * Splits an ASCII `string` into an array of its words.
761
+ *
762
+ * @private
763
+ * @param {string} The string to inspect.
764
+ * @returns {Array} Returns the words of `string`.
765
+ */
766
+ function asciiWords(string) {
767
+ return string.match(reAsciiWord) || [];
768
+ }
769
+
702
770
  /**
703
771
  * The base implementation of methods like `_.findKey` and `_.findLastKey`,
704
772
  * without support for iteratee shorthands, which iterates over `collection`
705
773
  * using `eachFunc`.
706
774
  *
707
775
  * @private
708
- * @param {Array|Object} collection The collection to search.
776
+ * @param {Array|Object} collection The collection to inspect.
709
777
  * @param {Function} predicate The function invoked per iteration.
710
778
  * @param {Function} eachFunc The function to iterate over `collection`.
711
779
  * @returns {*} Returns the found element or its key, else `undefined`.
@@ -726,7 +794,7 @@
726
794
  * support for iteratee shorthands.
727
795
  *
728
796
  * @private
729
- * @param {Array} array The array to search.
797
+ * @param {Array} array The array to inspect.
730
798
  * @param {Function} predicate The function invoked per iteration.
731
799
  * @param {number} fromIndex The index to search from.
732
800
  * @param {boolean} [fromRight] Specify iterating from right to left.
@@ -748,7 +816,7 @@
748
816
  * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
749
817
  *
750
818
  * @private
751
- * @param {Array} array The array to search.
819
+ * @param {Array} array The array to inspect.
752
820
  * @param {*} value The value to search for.
753
821
  * @param {number} fromIndex The index to search from.
754
822
  * @returns {number} Returns the index of the matched value, else `-1`.
@@ -772,7 +840,7 @@
772
840
  * This function is like `baseIndexOf` except that it accepts a comparator.
773
841
  *
774
842
  * @private
775
- * @param {Array} array The array to search.
843
+ * @param {Array} array The array to inspect.
776
844
  * @param {*} value The value to search for.
777
845
  * @param {number} fromIndex The index to search from.
778
846
  * @param {Function} comparator The comparator invoked per element.
@@ -1035,7 +1103,8 @@
1035
1103
  }
1036
1104
 
1037
1105
  /**
1038
- * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
1106
+ * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
1107
+ * letters to basic Latin letters.
1039
1108
  *
1040
1109
  * @private
1041
1110
  * @param {string} letter The matched letter to deburr.
@@ -1075,6 +1144,28 @@
1075
1144
  return object == null ? undefined : object[key];
1076
1145
  }
1077
1146
 
1147
+ /**
1148
+ * Checks if `string` contains Unicode symbols.
1149
+ *
1150
+ * @private
1151
+ * @param {string} string The string to inspect.
1152
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1153
+ */
1154
+ function hasUnicode(string) {
1155
+ return reHasUnicode.test(string);
1156
+ }
1157
+
1158
+ /**
1159
+ * Checks if `string` contains a word composed of Unicode symbols.
1160
+ *
1161
+ * @private
1162
+ * @param {string} string The string to inspect.
1163
+ * @returns {boolean} Returns `true` if a word is found, else `false`.
1164
+ */
1165
+ function hasUnicodeWord(string) {
1166
+ return reHasUnicodeWord.test(string);
1167
+ }
1168
+
1078
1169
  /**
1079
1170
  * Checks if `value` is a host object in IE < 9.
1080
1171
  *
@@ -1129,7 +1220,7 @@
1129
1220
  }
1130
1221
 
1131
1222
  /**
1132
- * Creates a function that invokes `func` with its first argument transformed.
1223
+ * Creates a unary function that invokes `func` with its argument transformed.
1133
1224
  *
1134
1225
  * @private
1135
1226
  * @param {Function} func The function to wrap.
@@ -1209,14 +1300,9 @@
1209
1300
  * @returns {number} Returns the string size.
1210
1301
  */
1211
1302
  function stringSize(string) {
1212
- if (!(string && reHasComplexSymbol.test(string))) {
1213
- return string.length;
1214
- }
1215
- var result = reComplexSymbol.lastIndex = 0;
1216
- while (reComplexSymbol.test(string)) {
1217
- result++;
1218
- }
1219
- return result;
1303
+ return hasUnicode(string)
1304
+ ? unicodeSize(string)
1305
+ : asciiSize(string);
1220
1306
  }
1221
1307
 
1222
1308
  /**
@@ -1227,7 +1313,9 @@
1227
1313
  * @returns {Array} Returns the converted array.
1228
1314
  */
1229
1315
  function stringToArray(string) {
1230
- return string.match(reComplexSymbol);
1316
+ return hasUnicode(string)
1317
+ ? unicodeToArray(string)
1318
+ : asciiToArray(string);
1231
1319
  }
1232
1320
 
1233
1321
  /**
@@ -1239,6 +1327,43 @@
1239
1327
  */
1240
1328
  var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
1241
1329
 
1330
+ /**
1331
+ * Gets the size of a Unicode `string`.
1332
+ *
1333
+ * @private
1334
+ * @param {string} string The string inspect.
1335
+ * @returns {number} Returns the string size.
1336
+ */
1337
+ function unicodeSize(string) {
1338
+ var result = reUnicode.lastIndex = 0;
1339
+ while (reUnicode.test(string)) {
1340
+ result++;
1341
+ }
1342
+ return result;
1343
+ }
1344
+
1345
+ /**
1346
+ * Converts a Unicode `string` to an array.
1347
+ *
1348
+ * @private
1349
+ * @param {string} string The string to convert.
1350
+ * @returns {Array} Returns the converted array.
1351
+ */
1352
+ function unicodeToArray(string) {
1353
+ return string.match(reUnicode) || [];
1354
+ }
1355
+
1356
+ /**
1357
+ * Splits a Unicode `string` into an array of its words.
1358
+ *
1359
+ * @private
1360
+ * @param {string} The string to inspect.
1361
+ * @returns {Array} Returns the words of `string`.
1362
+ */
1363
+ function unicodeWords(string) {
1364
+ return string.match(reUnicodeWord) || [];
1365
+ }
1366
+
1242
1367
  /*--------------------------------------------------------------------------*/
1243
1368
 
1244
1369
  /**
@@ -1278,20 +1403,23 @@
1278
1403
  * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
1279
1404
  */
1280
1405
  function runInContext(context) {
1281
- context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;
1406
+ context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
1282
1407
 
1283
1408
  /** Built-in constructor references. */
1284
1409
  var Array = context.Array,
1285
1410
  Date = context.Date,
1286
1411
  Error = context.Error,
1412
+ Function = context.Function,
1287
1413
  Math = context.Math,
1414
+ Object = context.Object,
1288
1415
  RegExp = context.RegExp,
1416
+ String = context.String,
1289
1417
  TypeError = context.TypeError;
1290
1418
 
1291
1419
  /** Used for built-in method references. */
1292
- var arrayProto = context.Array.prototype,
1293
- objectProto = context.Object.prototype,
1294
- stringProto = context.String.prototype;
1420
+ var arrayProto = Array.prototype,
1421
+ funcProto = Function.prototype,
1422
+ objectProto = Object.prototype;
1295
1423
 
1296
1424
  /** Used to detect overreaching core-js shims. */
1297
1425
  var coreJsData = context['__core-js_shared__'];
@@ -1303,7 +1431,7 @@
1303
1431
  }());
1304
1432
 
1305
1433
  /** Used to resolve the decompiled source of functions. */
1306
- var funcToString = context.Function.prototype.toString;
1434
+ var funcToString = funcProto.toString;
1307
1435
 
1308
1436
  /** Used to check objects for own properties. */
1309
1437
  var hasOwnProperty = objectProto.hasOwnProperty;
@@ -1316,7 +1444,7 @@
1316
1444
 
1317
1445
  /**
1318
1446
  * Used to resolve the
1319
- * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
1447
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1320
1448
  * of values.
1321
1449
  */
1322
1450
  var objectToString = objectProto.toString;
@@ -1332,36 +1460,33 @@
1332
1460
 
1333
1461
  /** Built-in value references. */
1334
1462
  var Buffer = moduleExports ? context.Buffer : undefined,
1335
- Reflect = context.Reflect,
1336
1463
  Symbol = context.Symbol,
1337
1464
  Uint8Array = context.Uint8Array,
1338
- enumerate = Reflect ? Reflect.enumerate : undefined,
1465
+ getPrototype = overArg(Object.getPrototypeOf, Object),
1339
1466
  iteratorSymbol = Symbol ? Symbol.iterator : undefined,
1340
- objectCreate = context.Object.create,
1467
+ objectCreate = Object.create,
1341
1468
  propertyIsEnumerable = objectProto.propertyIsEnumerable,
1342
1469
  splice = arrayProto.splice,
1343
1470
  spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
1344
1471
 
1345
- /** Built-in method references that are mockable. */
1346
- var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
1347
- setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
1472
+ /** Mocked built-ins. */
1473
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
1474
+ ctxNow = Date && Date.now !== root.Date.now && Date.now,
1475
+ ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1348
1476
 
1349
1477
  /* Built-in method references for those with the same name as other `lodash` methods. */
1350
1478
  var nativeCeil = Math.ceil,
1351
1479
  nativeFloor = Math.floor,
1352
- nativeGetPrototype = Object.getPrototypeOf,
1353
1480
  nativeGetSymbols = Object.getOwnPropertySymbols,
1354
1481
  nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
1355
1482
  nativeIsFinite = context.isFinite,
1356
1483
  nativeJoin = arrayProto.join,
1357
- nativeKeys = Object.keys,
1484
+ nativeKeys = overArg(Object.keys, Object),
1358
1485
  nativeMax = Math.max,
1359
1486
  nativeMin = Math.min,
1360
1487
  nativeParseInt = context.parseInt,
1361
1488
  nativeRandom = Math.random,
1362
- nativeReplace = stringProto.replace,
1363
- nativeReverse = arrayProto.reverse,
1364
- nativeSplit = stringProto.split;
1489
+ nativeReverse = arrayProto.reverse;
1365
1490
 
1366
1491
  /* Built-in method references that are verified to be native. */
1367
1492
  var DataView = getNative(context, 'DataView'),
@@ -1369,11 +1494,11 @@
1369
1494
  Promise = getNative(context, 'Promise'),
1370
1495
  Set = getNative(context, 'Set'),
1371
1496
  WeakMap = getNative(context, 'WeakMap'),
1372
- nativeCreate = getNative(context.Object, 'create');
1497
+ nativeCreate = getNative(Object, 'create');
1373
1498
 
1374
1499
  /* Used to set `toString` methods. */
1375
1500
  var defineProperty = (function() {
1376
- var func = getNative(context.Object, 'defineProperty'),
1501
+ var func = getNative(Object, 'defineProperty'),
1377
1502
  name = getNative.name;
1378
1503
 
1379
1504
  return (name && name.length > 2) ? func : undefined;
@@ -2201,6 +2326,33 @@
2201
2326
 
2202
2327
  /*------------------------------------------------------------------------*/
2203
2328
 
2329
+ /**
2330
+ * Creates an array of the enumerable property names of the array-like `value`.
2331
+ *
2332
+ * @private
2333
+ * @param {*} value The value to query.
2334
+ * @param {boolean} inherited Specify returning inherited property names.
2335
+ * @returns {Array} Returns the array of property names.
2336
+ */
2337
+ function arrayLikeKeys(value, inherited) {
2338
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
2339
+ // Safari 9 makes `arguments.length` enumerable in strict mode.
2340
+ var result = (isArray(value) || isArguments(value))
2341
+ ? baseTimes(value.length, String)
2342
+ : [];
2343
+
2344
+ var length = result.length,
2345
+ skipIndexes = !!length;
2346
+
2347
+ for (var key in value) {
2348
+ if ((inherited || hasOwnProperty.call(value, key)) &&
2349
+ !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
2350
+ result.push(key);
2351
+ }
2352
+ }
2353
+ return result;
2354
+ }
2355
+
2204
2356
  /**
2205
2357
  * Used by `_.defaults` to customize its `_.assignIn` use.
2206
2358
  *
@@ -2237,7 +2389,7 @@
2237
2389
 
2238
2390
  /**
2239
2391
  * Assigns `value` to `key` of `object` if the existing value is not equivalent
2240
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
2392
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2241
2393
  * for equality comparisons.
2242
2394
  *
2243
2395
  * @private
@@ -2257,7 +2409,7 @@
2257
2409
  * Gets the index at which the `key` is found in `array` of key-value pairs.
2258
2410
  *
2259
2411
  * @private
2260
- * @param {Array} array The array to search.
2412
+ * @param {Array} array The array to inspect.
2261
2413
  * @param {*} key The key to search for.
2262
2414
  * @returns {number} Returns the index of the matched value, else `-1`.
2263
2415
  */
@@ -2445,14 +2597,13 @@
2445
2597
  if (object == null) {
2446
2598
  return !length;
2447
2599
  }
2448
- var index = length;
2449
- while (index--) {
2450
- var key = props[index],
2600
+ object = Object(object);
2601
+ while (length--) {
2602
+ var key = props[length],
2451
2603
  predicate = source[key],
2452
2604
  value = object[key];
2453
2605
 
2454
- if ((value === undefined &&
2455
- !(key in Object(object))) || !predicate(value)) {
2606
+ if ((value === undefined && !(key in object)) || !predicate(value)) {
2456
2607
  return false;
2457
2608
  }
2458
2609
  }
@@ -2479,7 +2630,7 @@
2479
2630
  * @param {Function} func The function to delay.
2480
2631
  * @param {number} wait The number of milliseconds to delay invocation.
2481
2632
  * @param {Array} args The arguments to provide to `func`.
2482
- * @returns {number} Returns the timer id.
2633
+ * @returns {number|Object} Returns the timer id or timeout object.
2483
2634
  */
2484
2635
  function baseDelay(func, wait, args) {
2485
2636
  if (typeof func != 'function') {
@@ -2824,12 +2975,7 @@
2824
2975
  * @returns {boolean} Returns `true` if `key` exists, else `false`.
2825
2976
  */
2826
2977
  function baseHas(object, key) {
2827
- // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
2828
- // that are composed entirely of index properties, return `false` for
2829
- // `hasOwnProperty` checks of them.
2830
- return object != null &&
2831
- (hasOwnProperty.call(object, key) ||
2832
- (typeof object == 'object' && key in object && getPrototype(object) === null));
2978
+ return object != null && hasOwnProperty.call(object, key);
2833
2979
  }
2834
2980
 
2835
2981
  /**
@@ -3203,40 +3349,47 @@
3203
3349
  }
3204
3350
 
3205
3351
  /**
3206
- * The base implementation of `_.keys` which doesn't skip the constructor
3207
- * property of prototypes or treat sparse arrays as dense.
3352
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
3208
3353
  *
3209
3354
  * @private
3210
3355
  * @param {Object} object The object to query.
3211
3356
  * @returns {Array} Returns the array of property names.
3212
3357
  */
3213
- var baseKeys = overArg(nativeKeys, Object);
3358
+ function baseKeys(object) {
3359
+ if (!isPrototype(object)) {
3360
+ return nativeKeys(object);
3361
+ }
3362
+ var result = [];
3363
+ for (var key in Object(object)) {
3364
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
3365
+ result.push(key);
3366
+ }
3367
+ }
3368
+ return result;
3369
+ }
3214
3370
 
3215
3371
  /**
3216
- * The base implementation of `_.keysIn` which doesn't skip the constructor
3217
- * property of prototypes or treat sparse arrays as dense.
3372
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
3218
3373
  *
3219
3374
  * @private
3220
3375
  * @param {Object} object The object to query.
3221
3376
  * @returns {Array} Returns the array of property names.
3222
3377
  */
3223
3378
  function baseKeysIn(object) {
3224
- object = object == null ? object : Object(object);
3379
+ if (!isObject(object)) {
3380
+ return nativeKeysIn(object);
3381
+ }
3382
+ var isProto = isPrototype(object),
3383
+ result = [];
3225
3384
 
3226
- var result = [];
3227
3385
  for (var key in object) {
3228
- result.push(key);
3386
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
3387
+ result.push(key);
3388
+ }
3229
3389
  }
3230
3390
  return result;
3231
3391
  }
3232
3392
 
3233
- // Fallback for IE < 9 with es6-shim.
3234
- if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {
3235
- baseKeysIn = function(object) {
3236
- return iteratorToArray(enumerate(object));
3237
- };
3238
- }
3239
-
3240
3393
  /**
3241
3394
  * The base implementation of `_.lt` which doesn't coerce arguments.
3242
3395
  *
@@ -3321,7 +3474,7 @@
3321
3474
  return;
3322
3475
  }
3323
3476
  if (!(isArray(source) || isTypedArray(source))) {
3324
- var props = keysIn(source);
3477
+ var props = baseKeysIn(source);
3325
3478
  }
3326
3479
  arrayEach(props || source, function(srcValue, key) {
3327
3480
  if (props) {
@@ -3681,13 +3834,16 @@
3681
3834
  * The base implementation of `_.set`.
3682
3835
  *
3683
3836
  * @private
3684
- * @param {Object} object The object to query.
3837
+ * @param {Object} object The object to modify.
3685
3838
  * @param {Array|string} path The path of the property to set.
3686
3839
  * @param {*} value The value to set.
3687
3840
  * @param {Function} [customizer] The function to customize path creation.
3688
3841
  * @returns {Object} Returns `object`.
3689
3842
  */
3690
3843
  function baseSet(object, path, value, customizer) {
3844
+ if (!isObject(object)) {
3845
+ return object;
3846
+ }
3691
3847
  path = isKey(path, object) ? [path] : castPath(path);
3692
3848
 
3693
3849
  var index = -1,
@@ -3696,20 +3852,19 @@
3696
3852
  nested = object;
3697
3853
 
3698
3854
  while (nested != null && ++index < length) {
3699
- var key = toKey(path[index]);
3700
- if (isObject(nested)) {
3701
- var newValue = value;
3702
- if (index != lastIndex) {
3703
- var objValue = nested[key];
3704
- newValue = customizer ? customizer(objValue, key, nested) : undefined;
3705
- if (newValue === undefined) {
3706
- newValue = objValue == null
3707
- ? (isIndex(path[index + 1]) ? [] : {})
3708
- : objValue;
3709
- }
3855
+ var key = toKey(path[index]),
3856
+ newValue = value;
3857
+
3858
+ if (index != lastIndex) {
3859
+ var objValue = nested[key];
3860
+ newValue = customizer ? customizer(objValue, key, nested) : undefined;
3861
+ if (newValue === undefined) {
3862
+ newValue = isObject(objValue)
3863
+ ? objValue
3864
+ : (isIndex(path[index + 1]) ? [] : {});
3710
3865
  }
3711
- assignValue(nested, key, newValue);
3712
3866
  }
3867
+ assignValue(nested, key, newValue);
3713
3868
  nested = nested[key];
3714
3869
  }
3715
3870
  return object;
@@ -4002,14 +4157,14 @@
4002
4157
  object = parent(object, path);
4003
4158
 
4004
4159
  var key = toKey(last(path));
4005
- return !(object != null && baseHas(object, key)) || delete object[key];
4160
+ return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
4006
4161
  }
4007
4162
 
4008
4163
  /**
4009
4164
  * The base implementation of `_.update`.
4010
4165
  *
4011
4166
  * @private
4012
- * @param {Object} object The object to query.
4167
+ * @param {Object} object The object to modify.
4013
4168
  * @param {Array|string} path The path of the property to update.
4014
4169
  * @param {Function} updater The function to produce the updated value.
4015
4170
  * @param {Function} [customizer] The function to customize path creation.
@@ -4157,6 +4312,16 @@
4157
4312
  return (!start && end >= length) ? array : baseSlice(array, start, end);
4158
4313
  }
4159
4314
 
4315
+ /**
4316
+ * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
4317
+ *
4318
+ * @private
4319
+ * @param {number|Object} id The timer id or timeout object of the timer to clear.
4320
+ */
4321
+ var clearTimeout = ctxClearTimeout || function(id) {
4322
+ return root.clearTimeout(id);
4323
+ };
4324
+
4160
4325
  /**
4161
4326
  * Creates a clone of `buffer`.
4162
4327
  *
@@ -4610,7 +4775,7 @@
4610
4775
  return function(string) {
4611
4776
  string = toString(string);
4612
4777
 
4613
- var strSymbols = reHasComplexSymbol.test(string)
4778
+ var strSymbols = hasUnicode(string)
4614
4779
  ? stringToArray(string)
4615
4780
  : undefined;
4616
4781
 
@@ -4650,7 +4815,7 @@
4650
4815
  function createCtor(Ctor) {
4651
4816
  return function() {
4652
4817
  // Use a `switch` statement to work with class constructors. See
4653
- // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
4818
+ // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
4654
4819
  // for more details.
4655
4820
  var args = arguments;
4656
4821
  switch (args.length) {
@@ -4953,7 +5118,7 @@
4953
5118
  return charsLength ? baseRepeat(chars, length) : chars;
4954
5119
  }
4955
5120
  var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
4956
- return reHasComplexSymbol.test(chars)
5121
+ return hasUnicode(chars)
4957
5122
  ? castSlice(stringToArray(result), 0, length).join('')
4958
5123
  : result.slice(0, length);
4959
5124
  }
@@ -5338,7 +5503,7 @@
5338
5503
  case regexpTag:
5339
5504
  case stringTag:
5340
5505
  // Coerce regexes to strings and treat strings, primitives and objects,
5341
- // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
5506
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
5342
5507
  // for more details.
5343
5508
  return object == (other + '');
5344
5509
 
@@ -5400,7 +5565,7 @@
5400
5565
  var index = objLength;
5401
5566
  while (index--) {
5402
5567
  var key = objProps[index];
5403
- if (!(isPartial ? key in other : baseHas(other, key))) {
5568
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
5404
5569
  return false;
5405
5570
  }
5406
5571
  }
@@ -5536,19 +5701,6 @@
5536
5701
  return arguments.length ? result(arguments[0], arguments[1]) : result;
5537
5702
  }
5538
5703
 
5539
- /**
5540
- * Gets the "length" property value of `object`.
5541
- *
5542
- * **Note:** This function is used to avoid a
5543
- * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
5544
- * Safari on at least iOS 8.1-8.3 ARM64.
5545
- *
5546
- * @private
5547
- * @param {Object} object The object to query.
5548
- * @returns {*} Returns the "length" value.
5549
- */
5550
- var getLength = baseProperty('length');
5551
-
5552
5704
  /**
5553
5705
  * Gets the data for `map`.
5554
5706
  *
@@ -5597,15 +5749,6 @@
5597
5749
  return baseIsNative(value) ? value : undefined;
5598
5750
  }
5599
5751
 
5600
- /**
5601
- * Gets the `[[Prototype]]` of `value`.
5602
- *
5603
- * @private
5604
- * @param {*} value The value to query.
5605
- * @returns {null|Object} Returns the `[[Prototype]]`.
5606
- */
5607
- var getPrototype = overArg(nativeGetPrototype, Object);
5608
-
5609
5752
  /**
5610
5753
  * Creates an array of the own enumerable symbol properties of `object`.
5611
5754
  *
@@ -5642,7 +5785,7 @@
5642
5785
  var getTag = baseGetTag;
5643
5786
 
5644
5787
  // Fallback for data views, maps, sets, and weak maps in IE 11,
5645
- // for data views in Edge, and promises in Node.js.
5788
+ // for data views in Edge < 14, and promises in Node.js.
5646
5789
  if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
5647
5790
  (Map && getTag(new Map) != mapTag) ||
5648
5791
  (Promise && getTag(Promise.resolve()) != promiseTag) ||
@@ -5734,7 +5877,7 @@
5734
5877
  }
5735
5878
  var length = object ? object.length : 0;
5736
5879
  return !!length && isLength(length) && isIndex(key, length) &&
5737
- (isArray(object) || isString(object) || isArguments(object));
5880
+ (isArray(object) || isArguments(object));
5738
5881
  }
5739
5882
 
5740
5883
  /**
@@ -5818,23 +5961,6 @@
5818
5961
  }
5819
5962
  }
5820
5963
 
5821
- /**
5822
- * Creates an array of index keys for `object` values of arrays,
5823
- * `arguments` objects, and strings, otherwise `null` is returned.
5824
- *
5825
- * @private
5826
- * @param {Object} object The object to query.
5827
- * @returns {Array|null} Returns index keys, else `null`.
5828
- */
5829
- function indexKeys(object) {
5830
- var length = object ? object.length : undefined;
5831
- if (isLength(length) &&
5832
- (isArray(object) || isString(object) || isArguments(object))) {
5833
- return baseTimes(length, String);
5834
- }
5835
- return null;
5836
- }
5837
-
5838
5964
  /**
5839
5965
  * Inserts wrapper `details` in a comment at the top of the `source` body.
5840
5966
  *
@@ -6119,6 +6245,25 @@
6119
6245
  return objValue;
6120
6246
  }
6121
6247
 
6248
+ /**
6249
+ * This function is like
6250
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
6251
+ * except that it includes inherited enumerable properties.
6252
+ *
6253
+ * @private
6254
+ * @param {Object} object The object to query.
6255
+ * @returns {Array} Returns the array of property names.
6256
+ */
6257
+ function nativeKeysIn(object) {
6258
+ var result = [];
6259
+ if (object != null) {
6260
+ for (var key in Object(object)) {
6261
+ result.push(key);
6262
+ }
6263
+ }
6264
+ return result;
6265
+ }
6266
+
6122
6267
  /**
6123
6268
  * Gets the parent value at `path` of `object`.
6124
6269
  *
@@ -6187,6 +6332,18 @@
6187
6332
  };
6188
6333
  }());
6189
6334
 
6335
+ /**
6336
+ * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
6337
+ *
6338
+ * @private
6339
+ * @param {Function} func The function to delay.
6340
+ * @param {number} wait The number of milliseconds to delay invocation.
6341
+ * @returns {number|Object} Returns the timer id or timeout object.
6342
+ */
6343
+ var setTimeout = ctxSetTimeout || function(func, wait) {
6344
+ return root.setTimeout(func, wait);
6345
+ };
6346
+
6190
6347
  /**
6191
6348
  * Sets the `toString` method of `wrapper` to mimic the source of `reference`
6192
6349
  * with wrapper details in a comment at the top of the source body.
@@ -6407,7 +6564,7 @@
6407
6564
 
6408
6565
  /**
6409
6566
  * Creates an array of `array` values not included in the other given arrays
6410
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
6567
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
6411
6568
  * for equality comparisons. The order of result values is determined by the
6412
6569
  * order they occur in the first array.
6413
6570
  *
@@ -6701,7 +6858,7 @@
6701
6858
  * @memberOf _
6702
6859
  * @since 1.1.0
6703
6860
  * @category Array
6704
- * @param {Array} array The array to search.
6861
+ * @param {Array} array The array to inspect.
6705
6862
  * @param {Function} [predicate=_.identity]
6706
6863
  * The function invoked per iteration.
6707
6864
  * @param {number} [fromIndex=0] The index to search from.
@@ -6749,7 +6906,7 @@
6749
6906
  * @memberOf _
6750
6907
  * @since 2.0.0
6751
6908
  * @category Array
6752
- * @param {Array} array The array to search.
6909
+ * @param {Array} array The array to inspect.
6753
6910
  * @param {Function} [predicate=_.identity]
6754
6911
  * The function invoked per iteration.
6755
6912
  * @param {number} [fromIndex=array.length-1] The index to search from.
@@ -6910,7 +7067,7 @@
6910
7067
 
6911
7068
  /**
6912
7069
  * Gets the index at which the first occurrence of `value` is found in `array`
6913
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
7070
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
6914
7071
  * for equality comparisons. If `fromIndex` is negative, it's used as the
6915
7072
  * offset from the end of `array`.
6916
7073
  *
@@ -6918,7 +7075,7 @@
6918
7075
  * @memberOf _
6919
7076
  * @since 0.1.0
6920
7077
  * @category Array
6921
- * @param {Array} array The array to search.
7078
+ * @param {Array} array The array to inspect.
6922
7079
  * @param {*} value The value to search for.
6923
7080
  * @param {number} [fromIndex=0] The index to search from.
6924
7081
  * @returns {number} Returns the index of the matched value, else `-1`.
@@ -6958,12 +7115,13 @@
6958
7115
  * // => [1, 2]
6959
7116
  */
6960
7117
  function initial(array) {
6961
- return dropRight(array, 1);
7118
+ var length = array ? array.length : 0;
7119
+ return length ? baseSlice(array, 0, -1) : [];
6962
7120
  }
6963
7121
 
6964
7122
  /**
6965
7123
  * Creates an array of unique values that are included in all given arrays
6966
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
7124
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
6967
7125
  * for equality comparisons. The order of result values is determined by the
6968
7126
  * order they occur in the first array.
6969
7127
  *
@@ -7102,7 +7260,7 @@
7102
7260
  * @memberOf _
7103
7261
  * @since 0.1.0
7104
7262
  * @category Array
7105
- * @param {Array} array The array to search.
7263
+ * @param {Array} array The array to inspect.
7106
7264
  * @param {*} value The value to search for.
7107
7265
  * @param {number} [fromIndex=array.length-1] The index to search from.
7108
7266
  * @returns {number} Returns the index of the matched value, else `-1`.
@@ -7167,7 +7325,7 @@
7167
7325
 
7168
7326
  /**
7169
7327
  * Removes all given values from `array` using
7170
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
7328
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7171
7329
  * for equality comparisons.
7172
7330
  *
7173
7331
  * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
@@ -7480,7 +7638,7 @@
7480
7638
  * @memberOf _
7481
7639
  * @since 4.0.0
7482
7640
  * @category Array
7483
- * @param {Array} array The array to search.
7641
+ * @param {Array} array The array to inspect.
7484
7642
  * @param {*} value The value to search for.
7485
7643
  * @returns {number} Returns the index of the matched value, else `-1`.
7486
7644
  * @example
@@ -7559,7 +7717,7 @@
7559
7717
  * @memberOf _
7560
7718
  * @since 4.0.0
7561
7719
  * @category Array
7562
- * @param {Array} array The array to search.
7720
+ * @param {Array} array The array to inspect.
7563
7721
  * @param {*} value The value to search for.
7564
7722
  * @returns {number} Returns the index of the matched value, else `-1`.
7565
7723
  * @example
@@ -7636,7 +7794,8 @@
7636
7794
  * // => [2, 3]
7637
7795
  */
7638
7796
  function tail(array) {
7639
- return drop(array, 1);
7797
+ var length = array ? array.length : 0;
7798
+ return length ? baseSlice(array, 1, length) : [];
7640
7799
  }
7641
7800
 
7642
7801
  /**
@@ -7793,7 +7952,7 @@
7793
7952
 
7794
7953
  /**
7795
7954
  * Creates an array of unique values, in order, from all given arrays using
7796
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
7955
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7797
7956
  * for equality comparisons.
7798
7957
  *
7799
7958
  * @static
@@ -7874,7 +8033,7 @@
7874
8033
 
7875
8034
  /**
7876
8035
  * Creates a duplicate-free version of an array, using
7877
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
8036
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7878
8037
  * for equality comparisons, in which only the first occurrence of each
7879
8038
  * element is kept.
7880
8039
  *
@@ -8019,7 +8178,7 @@
8019
8178
 
8020
8179
  /**
8021
8180
  * Creates an array excluding all given values using
8022
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
8181
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8023
8182
  * for equality comparisons.
8024
8183
  *
8025
8184
  * **Note:** Unlike `_.pull`, this method returns a new array.
@@ -8590,6 +8749,11 @@
8590
8749
  * Iteration is stopped once `predicate` returns falsey. The predicate is
8591
8750
  * invoked with three arguments: (value, index|key, collection).
8592
8751
  *
8752
+ * **Note:** This method returns `true` for
8753
+ * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
8754
+ * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
8755
+ * elements of empty collections.
8756
+ *
8593
8757
  * @static
8594
8758
  * @memberOf _
8595
8759
  * @since 0.1.0
@@ -8682,7 +8846,7 @@
8682
8846
  * @memberOf _
8683
8847
  * @since 0.1.0
8684
8848
  * @category Collection
8685
- * @param {Array|Object} collection The collection to search.
8849
+ * @param {Array|Object} collection The collection to inspect.
8686
8850
  * @param {Function} [predicate=_.identity]
8687
8851
  * The function invoked per iteration.
8688
8852
  * @param {number} [fromIndex=0] The index to search from.
@@ -8720,7 +8884,7 @@
8720
8884
  * @memberOf _
8721
8885
  * @since 2.0.0
8722
8886
  * @category Collection
8723
- * @param {Array|Object} collection The collection to search.
8887
+ * @param {Array|Object} collection The collection to inspect.
8724
8888
  * @param {Function} [predicate=_.identity]
8725
8889
  * The function invoked per iteration.
8726
8890
  * @param {number} [fromIndex=collection.length-1] The index to search from.
@@ -8907,7 +9071,7 @@
8907
9071
  /**
8908
9072
  * Checks if `value` is in `collection`. If `collection` is a string, it's
8909
9073
  * checked for a substring of `value`, otherwise
8910
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
9074
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8911
9075
  * is used for equality comparisons. If `fromIndex` is negative, it's used as
8912
9076
  * the offset from the end of `collection`.
8913
9077
  *
@@ -8915,7 +9079,7 @@
8915
9079
  * @memberOf _
8916
9080
  * @since 0.1.0
8917
9081
  * @category Collection
8918
- * @param {Array|Object|string} collection The collection to search.
9082
+ * @param {Array|Object|string} collection The collection to inspect.
8919
9083
  * @param {*} value The value to search for.
8920
9084
  * @param {number} [fromIndex=0] The index to search from.
8921
9085
  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
@@ -9348,7 +9512,7 @@
9348
9512
  * @memberOf _
9349
9513
  * @since 0.1.0
9350
9514
  * @category Collection
9351
- * @param {Array|Object} collection The collection to inspect.
9515
+ * @param {Array|Object|string} collection The collection to inspect.
9352
9516
  * @returns {number} Returns the collection size.
9353
9517
  * @example
9354
9518
  *
@@ -9366,16 +9530,13 @@
9366
9530
  return 0;
9367
9531
  }
9368
9532
  if (isArrayLike(collection)) {
9369
- var result = collection.length;
9370
- return (result && isString(collection)) ? stringSize(collection) : result;
9533
+ return isString(collection) ? stringSize(collection) : collection.length;
9371
9534
  }
9372
- if (isObjectLike(collection)) {
9373
- var tag = getTag(collection);
9374
- if (tag == mapTag || tag == setTag) {
9375
- return collection.size;
9376
- }
9535
+ var tag = getTag(collection);
9536
+ if (tag == mapTag || tag == setTag) {
9537
+ return collection.size;
9377
9538
  }
9378
- return keys(collection).length;
9539
+ return baseKeys(collection).length;
9379
9540
  }
9380
9541
 
9381
9542
  /**
@@ -9487,9 +9648,9 @@
9487
9648
  * }, _.now());
9488
9649
  * // => Logs the number of milliseconds it took for the deferred invocation.
9489
9650
  */
9490
- function now() {
9491
- return Date.now();
9492
- }
9651
+ var now = ctxNow || function() {
9652
+ return root.Date.now();
9653
+ };
9493
9654
 
9494
9655
  /*------------------------------------------------------------------------*/
9495
9656
 
@@ -10030,7 +10191,7 @@
10030
10191
  * **Note:** The cache is exposed as the `cache` property on the memoized
10031
10192
  * function. Its creation may be customized by replacing the `_.memoize.Cache`
10032
10193
  * constructor with one whose instances implement the
10033
- * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
10194
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
10034
10195
  * method interface of `delete`, `get`, `has`, and `set`.
10035
10196
  *
10036
10197
  * @static
@@ -10330,7 +10491,7 @@
10330
10491
  /**
10331
10492
  * Creates a function that invokes `func` with the `this` binding of the
10332
10493
  * create function and an array of arguments much like
10333
- * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).
10494
+ * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
10334
10495
  *
10335
10496
  * **Note:** This method is based on the
10336
10497
  * [spread operator](https://mdn.io/spread_operator).
@@ -10677,7 +10838,7 @@
10677
10838
 
10678
10839
  /**
10679
10840
  * Performs a
10680
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
10841
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
10681
10842
  * comparison between two values to determine if they are equivalent.
10682
10843
  *
10683
10844
  * @static
@@ -10782,7 +10943,7 @@
10782
10943
  * // => false
10783
10944
  */
10784
10945
  function isArguments(value) {
10785
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
10946
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
10786
10947
  return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
10787
10948
  (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
10788
10949
  }
@@ -10857,7 +11018,7 @@
10857
11018
  * // => false
10858
11019
  */
10859
11020
  function isArrayLike(value) {
10860
- return value != null && isLength(getLength(value)) && !isFunction(value);
11021
+ return value != null && isLength(value.length) && !isFunction(value);
10861
11022
  }
10862
11023
 
10863
11024
  /**
@@ -10957,8 +11118,7 @@
10957
11118
  * @since 0.1.0
10958
11119
  * @category Lang
10959
11120
  * @param {*} value The value to check.
10960
- * @returns {boolean} Returns `true` if `value` is a DOM element,
10961
- * else `false`.
11121
+ * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
10962
11122
  * @example
10963
11123
  *
10964
11124
  * _.isElement(document.body);
@@ -11006,22 +11166,23 @@
11006
11166
  */
11007
11167
  function isEmpty(value) {
11008
11168
  if (isArrayLike(value) &&
11009
- (isArray(value) || isString(value) || isFunction(value.splice) ||
11010
- isArguments(value) || isBuffer(value))) {
11169
+ (isArray(value) || typeof value == 'string' ||
11170
+ typeof value.splice == 'function' || isBuffer(value) || isArguments(value))) {
11011
11171
  return !value.length;
11012
11172
  }
11013
- if (isObjectLike(value)) {
11014
- var tag = getTag(value);
11015
- if (tag == mapTag || tag == setTag) {
11016
- return !value.size;
11017
- }
11173
+ var tag = getTag(value);
11174
+ if (tag == mapTag || tag == setTag) {
11175
+ return !value.size;
11176
+ }
11177
+ if (nonEnumShadows || isPrototype(value)) {
11178
+ return !nativeKeys(value).length;
11018
11179
  }
11019
11180
  for (var key in value) {
11020
11181
  if (hasOwnProperty.call(value, key)) {
11021
11182
  return false;
11022
11183
  }
11023
11184
  }
11024
- return !(nonEnumShadows && keys(value).length);
11185
+ return true;
11025
11186
  }
11026
11187
 
11027
11188
  /**
@@ -11040,8 +11201,7 @@
11040
11201
  * @category Lang
11041
11202
  * @param {*} value The value to compare.
11042
11203
  * @param {*} other The other value to compare.
11043
- * @returns {boolean} Returns `true` if the values are equivalent,
11044
- * else `false`.
11204
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11045
11205
  * @example
11046
11206
  *
11047
11207
  * var object = { 'a': 1 };
@@ -11070,8 +11230,7 @@
11070
11230
  * @param {*} value The value to compare.
11071
11231
  * @param {*} other The other value to compare.
11072
11232
  * @param {Function} [customizer] The function to customize comparisons.
11073
- * @returns {boolean} Returns `true` if the values are equivalent,
11074
- * else `false`.
11233
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11075
11234
  * @example
11076
11235
  *
11077
11236
  * function isGreeting(value) {
@@ -11105,8 +11264,7 @@
11105
11264
  * @since 3.0.0
11106
11265
  * @category Lang
11107
11266
  * @param {*} value The value to check.
11108
- * @returns {boolean} Returns `true` if `value` is an error object,
11109
- * else `false`.
11267
+ * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
11110
11268
  * @example
11111
11269
  *
11112
11270
  * _.isError(new Error);
@@ -11134,8 +11292,7 @@
11134
11292
  * @since 0.1.0
11135
11293
  * @category Lang
11136
11294
  * @param {*} value The value to check.
11137
- * @returns {boolean} Returns `true` if `value` is a finite number,
11138
- * else `false`.
11295
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
11139
11296
  * @example
11140
11297
  *
11141
11298
  * _.isFinite(3);
@@ -11173,8 +11330,7 @@
11173
11330
  */
11174
11331
  function isFunction(value) {
11175
11332
  // The use of `Object#toString` avoids issues with the `typeof` operator
11176
- // in Safari 8 which returns 'object' for typed array and weak map constructors,
11177
- // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
11333
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
11178
11334
  var tag = isObject(value) ? objectToString.call(value) : '';
11179
11335
  return tag == funcTag || tag == genTag;
11180
11336
  }
@@ -11212,16 +11368,15 @@
11212
11368
  /**
11213
11369
  * Checks if `value` is a valid array-like length.
11214
11370
  *
11215
- * **Note:** This function is loosely based on
11216
- * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
11371
+ * **Note:** This method is loosely based on
11372
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
11217
11373
  *
11218
11374
  * @static
11219
11375
  * @memberOf _
11220
11376
  * @since 4.0.0
11221
11377
  * @category Lang
11222
11378
  * @param {*} value The value to check.
11223
- * @returns {boolean} Returns `true` if `value` is a valid length,
11224
- * else `false`.
11379
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
11225
11380
  * @example
11226
11381
  *
11227
11382
  * _.isLength(3);
@@ -11243,7 +11398,7 @@
11243
11398
 
11244
11399
  /**
11245
11400
  * Checks if `value` is the
11246
- * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
11401
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
11247
11402
  * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
11248
11403
  *
11249
11404
  * @static
@@ -11322,8 +11477,12 @@
11322
11477
  * Performs a partial deep comparison between `object` and `source` to
11323
11478
  * determine if `object` contains equivalent property values.
11324
11479
  *
11325
- * **Note:** This method supports comparing the same values as `_.isEqual`
11326
- * and is equivalent to `_.matches` when `source` is partially applied.
11480
+ * **Note:** This method is equivalent to `_.matches` when `source` is
11481
+ * partially applied.
11482
+ *
11483
+ * Partial comparisons will match empty array and empty object `source`
11484
+ * values against any array or object value, respectively. See `_.isEqual`
11485
+ * for a list of supported value comparisons.
11327
11486
  *
11328
11487
  * @static
11329
11488
  * @memberOf _
@@ -11536,8 +11695,7 @@
11536
11695
  * @since 0.8.0
11537
11696
  * @category Lang
11538
11697
  * @param {*} value The value to check.
11539
- * @returns {boolean} Returns `true` if `value` is a plain object,
11540
- * else `false`.
11698
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
11541
11699
  * @example
11542
11700
  *
11543
11701
  * function Foo() {
@@ -11601,8 +11759,7 @@
11601
11759
  * @since 4.0.0
11602
11760
  * @category Lang
11603
11761
  * @param {*} value The value to check.
11604
- * @returns {boolean} Returns `true` if `value` is a safe integer,
11605
- * else `false`.
11762
+ * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
11606
11763
  * @example
11607
11764
  *
11608
11765
  * _.isSafeInteger(3);
@@ -11896,7 +12053,7 @@
11896
12053
  * Converts `value` to an integer.
11897
12054
  *
11898
12055
  * **Note:** This method is loosely based on
11899
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
12056
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
11900
12057
  *
11901
12058
  * @static
11902
12059
  * @memberOf _
@@ -11930,7 +12087,7 @@
11930
12087
  * array-like object.
11931
12088
  *
11932
12089
  * **Note:** This method is based on
11933
- * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
12090
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
11934
12091
  *
11935
12092
  * @static
11936
12093
  * @memberOf _
@@ -11987,7 +12144,7 @@
11987
12144
  return NAN;
11988
12145
  }
11989
12146
  if (isObject(value)) {
11990
- var other = isFunction(value.valueOf) ? value.valueOf() : value;
12147
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
11991
12148
  value = isObject(other) ? (other + '') : other;
11992
12149
  }
11993
12150
  if (typeof value != 'string') {
@@ -12159,13 +12316,7 @@
12159
12316
  * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
12160
12317
  */
12161
12318
  var assignIn = createAssigner(function(object, source) {
12162
- if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
12163
- copyObject(source, keysIn(source), object);
12164
- return;
12165
- }
12166
- for (var key in source) {
12167
- assignValue(object, key, source[key]);
12168
- }
12319
+ copyObject(source, keysIn(source), object);
12169
12320
  });
12170
12321
 
12171
12322
  /**
@@ -12351,7 +12502,7 @@
12351
12502
  * @memberOf _
12352
12503
  * @since 1.1.0
12353
12504
  * @category Object
12354
- * @param {Object} object The object to search.
12505
+ * @param {Object} object The object to inspect.
12355
12506
  * @param {Function} [predicate=_.identity] The function invoked per iteration.
12356
12507
  * @returns {string|undefined} Returns the key of the matched element,
12357
12508
  * else `undefined`.
@@ -12390,7 +12541,7 @@
12390
12541
  * @memberOf _
12391
12542
  * @since 2.0.0
12392
12543
  * @category Object
12393
- * @param {Object} object The object to search.
12544
+ * @param {Object} object The object to inspect.
12394
12545
  * @param {Function} [predicate=_.identity] The function invoked per iteration.
12395
12546
  * @returns {string|undefined} Returns the key of the matched element,
12396
12547
  * else `undefined`.
@@ -12774,7 +12925,7 @@
12774
12925
  * Creates an array of the own enumerable property names of `object`.
12775
12926
  *
12776
12927
  * **Note:** Non-object values are coerced to objects. See the
12777
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
12928
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
12778
12929
  * for more details.
12779
12930
  *
12780
12931
  * @static
@@ -12799,23 +12950,7 @@
12799
12950
  * // => ['0', '1']
12800
12951
  */
12801
12952
  function keys(object) {
12802
- var isProto = isPrototype(object);
12803
- if (!(isProto || isArrayLike(object))) {
12804
- return baseKeys(object);
12805
- }
12806
- var indexes = indexKeys(object),
12807
- skipIndexes = !!indexes,
12808
- result = indexes || [],
12809
- length = result.length;
12810
-
12811
- for (var key in object) {
12812
- if (baseHas(object, key) &&
12813
- !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
12814
- !(isProto && key == 'constructor')) {
12815
- result.push(key);
12816
- }
12817
- }
12818
- return result;
12953
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
12819
12954
  }
12820
12955
 
12821
12956
  /**
@@ -12842,23 +12977,7 @@
12842
12977
  * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
12843
12978
  */
12844
12979
  function keysIn(object) {
12845
- var index = -1,
12846
- isProto = isPrototype(object),
12847
- props = baseKeysIn(object),
12848
- propsLength = props.length,
12849
- indexes = indexKeys(object),
12850
- skipIndexes = !!indexes,
12851
- result = indexes || [],
12852
- length = result.length;
12853
-
12854
- while (++index < propsLength) {
12855
- var key = props[index];
12856
- if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
12857
- !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
12858
- result.push(key);
12859
- }
12860
- }
12861
- return result;
12980
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
12862
12981
  }
12863
12982
 
12864
12983
  /**
@@ -13664,8 +13783,9 @@
13664
13783
 
13665
13784
  /**
13666
13785
  * Deburrs `string` by converting
13667
- * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
13668
- * to basic latin letters and removing
13786
+ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
13787
+ * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
13788
+ * letters to basic Latin letters and removing
13669
13789
  * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
13670
13790
  *
13671
13791
  * @static
@@ -13681,7 +13801,7 @@
13681
13801
  */
13682
13802
  function deburr(string) {
13683
13803
  string = toString(string);
13684
- return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
13804
+ return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
13685
13805
  }
13686
13806
 
13687
13807
  /**
@@ -13691,7 +13811,7 @@
13691
13811
  * @memberOf _
13692
13812
  * @since 3.0.0
13693
13813
  * @category String
13694
- * @param {string} [string=''] The string to search.
13814
+ * @param {string} [string=''] The string to inspect.
13695
13815
  * @param {string} [target] The string to search for.
13696
13816
  * @param {number} [position=string.length] The position to search up to.
13697
13817
  * @returns {boolean} Returns `true` if `string` ends with `target`,
@@ -14047,7 +14167,7 @@
14047
14167
  var args = arguments,
14048
14168
  string = toString(args[0]);
14049
14169
 
14050
- return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
14170
+ return args.length < 3 ? string : string.replace(args[1], args[2]);
14051
14171
  }
14052
14172
 
14053
14173
  /**
@@ -14108,11 +14228,11 @@
14108
14228
  (separator != null && !isRegExp(separator))
14109
14229
  )) {
14110
14230
  separator = baseToString(separator);
14111
- if (separator == '' && reHasComplexSymbol.test(string)) {
14231
+ if (!separator && hasUnicode(string)) {
14112
14232
  return castSlice(stringToArray(string), 0, limit);
14113
14233
  }
14114
14234
  }
14115
- return nativeSplit.call(string, separator, limit);
14235
+ return string.split(separator, limit);
14116
14236
  }
14117
14237
 
14118
14238
  /**
@@ -14147,7 +14267,7 @@
14147
14267
  * @memberOf _
14148
14268
  * @since 3.0.0
14149
14269
  * @category String
14150
- * @param {string} [string=''] The string to search.
14270
+ * @param {string} [string=''] The string to inspect.
14151
14271
  * @param {string} [target] The string to search for.
14152
14272
  * @param {number} [position=0] The position to search from.
14153
14273
  * @returns {boolean} Returns `true` if `string` starts with `target`,
@@ -14584,7 +14704,7 @@
14584
14704
  string = toString(string);
14585
14705
 
14586
14706
  var strLength = string.length;
14587
- if (reHasComplexSymbol.test(string)) {
14707
+ if (hasUnicode(string)) {
14588
14708
  var strSymbols = stringToArray(string);
14589
14709
  strLength = strSymbols.length;
14590
14710
  }
@@ -14721,7 +14841,7 @@
14721
14841
  pattern = guard ? undefined : pattern;
14722
14842
 
14723
14843
  if (pattern === undefined) {
14724
- pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;
14844
+ return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
14725
14845
  }
14726
14846
  return string.match(pattern) || [];
14727
14847
  }
@@ -15038,8 +15158,12 @@
15038
15158
  * object and `source`, returning `true` if the given object has equivalent
15039
15159
  * property values, else `false`.
15040
15160
  *
15041
- * **Note:** The created function supports comparing the same values as
15042
- * `_.isEqual` is equivalent to `_.isMatch` with `source` partially applied.
15161
+ * **Note:** The created function is equivalent to `_.isMatch` with `source`
15162
+ * partially applied.
15163
+ *
15164
+ * Partial comparisons will match empty array and empty object `source`
15165
+ * values against any array or object value, respectively. See `_.isEqual`
15166
+ * for a list of supported value comparisons.
15043
15167
  *
15044
15168
  * @static
15045
15169
  * @memberOf _
@@ -15066,7 +15190,9 @@
15066
15190
  * value at `path` of a given object to `srcValue`, returning `true` if the
15067
15191
  * object value is equivalent, else `false`.
15068
15192
  *
15069
- * **Note:** This method supports comparing the same values as `_.isEqual`.
15193
+ * **Note:** Partial comparisons will match empty array and empty object
15194
+ * `srcValue` values against any array or object value, respectively. See
15195
+ * `_.isEqual` for a list of supported value comparisons.
15070
15196
  *
15071
15197
  * @static
15072
15198
  * @memberOf _