lodash-rails 3.9.3 → 3.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e68b7bc295668dde308b82203de11d70bbc4fb0d
4
- data.tar.gz: 5dff5e2a2e145a06baa3d6121ddbd67b79f4a6ae
3
+ metadata.gz: 5aaa71564b33ebd64664ea2ea701ed4fc2b56069
4
+ data.tar.gz: d20f0b7128d1956603ef5f5c840e276c53644e0f
5
5
  SHA512:
6
- metadata.gz: 1b8de3edf3042d0cdbb444dd05249f9fb5f86ac3a8df87aeb3f62bd83daf3ca4573b47a2a3c69bcb67404d21c661fa837e772086056dd389c54ad2541d9e9423
7
- data.tar.gz: ab96f3c348ebb4c5e97aad3c002144cfdb0b4481ece3d62df7a23e6ebef1e8a533a2d5b989587d11ae2edce63dbb99f4b41c8439c2cf861b434c24ea3e8a56ab
6
+ metadata.gz: 97917216b9887332a130d440c6184049785b7099cfb07d4e8c2cdca22400c3e7300f1b98a7c80f922179c1a21d55d1645687309dc71dde36cc17812c6d0c5e13
7
+ data.tar.gz: 004b24bc3c7022c3fe9d769bce1096367aae442712a0c3daa414e6931d6e6db8656b1b1bf7493abd87e07cd086659ec4b3162c07062961e2aeea9a2fc35f2e2b
data/README.md CHANGED
@@ -18,7 +18,7 @@ Add the necessary library to `app/assets/javascripts/application.js`:
18
18
 
19
19
  ## What's included?
20
20
 
21
- lodash 3.9.3:
21
+ lodash 3.10.0:
22
22
 
23
23
  * lodash.js
24
24
  * lodash.min.js
@@ -1,5 +1,5 @@
1
1
  module LoDash
2
2
  module Rails
3
- VERSION = "3.9.3"
3
+ VERSION = "3.10.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * lodash 3.9.3 (Custom Build) <https://lodash.com/>
3
+ * lodash 3.10.0 (Custom Build) <https://lodash.com/>
4
4
  * Build: `lodash compat -o ./lodash.js`
5
5
  * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
6
6
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -13,7 +13,7 @@
13
13
  var undefined;
14
14
 
15
15
  /** Used as the semantic version number. */
16
- var VERSION = '3.9.3';
16
+ var VERSION = '3.10.0';
17
17
 
18
18
  /** Used to compose bitmasks for wrapper metadata. */
19
19
  var BIND_FLAG = 1,
@@ -34,9 +34,11 @@
34
34
  var HOT_COUNT = 150,
35
35
  HOT_SPAN = 16;
36
36
 
37
+ /** Used as the size to enable large array optimizations. */
38
+ var LARGE_ARRAY_SIZE = 200;
39
+
37
40
  /** Used to indicate the type of lazy iteratees. */
38
- var LAZY_DROP_WHILE_FLAG = 0,
39
- LAZY_FILTER_FLAG = 1,
41
+ var LAZY_FILTER_FLAG = 1,
40
42
  LAZY_MAP_FLAG = 2;
41
43
 
42
44
  /** Used as the `TypeError` message for "Functions" methods. */
@@ -93,11 +95,10 @@
93
95
  rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
94
96
 
95
97
  /**
96
- * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
97
- * In addition to special characters the forward slash is escaped to allow for
98
- * easier `eval` use and `Function` compilation.
98
+ * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
99
+ * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
99
100
  */
100
- var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
101
+ var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
101
102
  reHasRegExpChars = RegExp(reRegExpChars.source);
102
103
 
103
104
  /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
@@ -106,7 +107,7 @@
106
107
  /** Used to match backslashes in property paths. */
107
108
  var reEscapeChar = /\\(\\)?/g;
108
109
 
109
- /** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
110
+ /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
110
111
  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
111
112
 
112
113
  /** Used to match `RegExp` flags from their coerced string values. */
@@ -138,25 +139,13 @@
138
139
  return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
139
140
  }());
140
141
 
141
- /** Used to detect and test for whitespace. */
142
- var whitespace = (
143
- // Basic whitespace characters.
144
- ' \t\x0b\f\xa0\ufeff' +
145
-
146
- // Line terminators.
147
- '\n\r\u2028\u2029' +
148
-
149
- // Unicode category "Zs" space separators.
150
- '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
151
- );
152
-
153
142
  /** Used to assign default `context` object properties. */
154
143
  var contextProps = [
155
144
  'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
156
145
  'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
157
- 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
158
- 'isFinite', 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
159
- 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'window'
146
+ 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
147
+ 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
148
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
160
149
  ];
161
150
 
162
151
  /** Used to fix the JScript `[[DontEnum]]` bug. */
@@ -198,13 +187,6 @@
198
187
  cloneableTags[mapTag] = cloneableTags[setTag] =
199
188
  cloneableTags[weakMapTag] = false;
200
189
 
201
- /** Used as an internal `_.debounce` options object by `_.throttle`. */
202
- var debounceOptions = {
203
- 'leading': false,
204
- 'maxWait': 0,
205
- 'trailing': false
206
- };
207
-
208
190
  /** Used to map latin-1 supplementary letters to basic latin letters. */
209
191
  var deburredLetters = {
210
192
  '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
@@ -252,6 +234,15 @@
252
234
  'object': true
253
235
  };
254
236
 
237
+ /** Used to escape characters for inclusion in compiled regexes. */
238
+ var regexpEscapes = {
239
+ '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
240
+ '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
241
+ 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
242
+ 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
243
+ 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
244
+ };
245
+
255
246
  /** Used to escape characters for inclusion in compiled string literals. */
256
247
  var stringEscapes = {
257
248
  '\\': '\\',
@@ -392,9 +383,6 @@
392
383
  * @returns {string} Returns the string.
393
384
  */
394
385
  function baseToString(value) {
395
- if (typeof value == 'string') {
396
- return value;
397
- }
398
386
  return value == null ? '' : (value + '');
399
387
  }
400
388
 
@@ -436,8 +424,8 @@
436
424
  * sort them in ascending order.
437
425
  *
438
426
  * @private
439
- * @param {Object} object The object to compare to `other`.
440
- * @param {Object} other The object to compare to `object`.
427
+ * @param {Object} object The object to compare.
428
+ * @param {Object} other The other object to compare.
441
429
  * @returns {number} Returns the sort order indicator for `object`.
442
430
  */
443
431
  function compareAscending(object, other) {
@@ -445,16 +433,16 @@
445
433
  }
446
434
 
447
435
  /**
448
- * Used by `_.sortByOrder` to compare multiple properties of each element
449
- * in a collection and stable sort them in the following order:
436
+ * Used by `_.sortByOrder` to compare multiple properties of a value to another
437
+ * and stable sort them.
450
438
  *
451
- * If `orders` is unspecified, sort in ascending order for all properties.
452
- * Otherwise, for each property, sort in ascending order if its corresponding value in
453
- * orders is true, and descending order if false.
439
+ * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,
440
+ * a value is sorted in ascending order if its corresponding order is "asc", and
441
+ * descending if "desc".
454
442
  *
455
443
  * @private
456
- * @param {Object} object The object to compare to `other`.
457
- * @param {Object} other The object to compare to `object`.
444
+ * @param {Object} object The object to compare.
445
+ * @param {Object} other The other object to compare.
458
446
  * @param {boolean[]} orders The order to sort by for each property.
459
447
  * @returns {number} Returns the sort order indicator for `object`.
460
448
  */
@@ -471,7 +459,8 @@
471
459
  if (index >= ordersLength) {
472
460
  return result;
473
461
  }
474
- return result * (orders[index] ? 1 : -1);
462
+ var order = orders[index];
463
+ return result * ((order === 'asc' || order === true) ? 1 : -1);
475
464
  }
476
465
  }
477
466
  // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
@@ -507,8 +496,25 @@
507
496
  }
508
497
 
509
498
  /**
510
- * Used by `_.template` to escape characters for inclusion in compiled
511
- * string literals.
499
+ * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
500
+ *
501
+ * @private
502
+ * @param {string} chr The matched character to escape.
503
+ * @param {string} leadingChar The capture group for a leading character.
504
+ * @param {string} whitespaceChar The capture group for a whitespace character.
505
+ * @returns {string} Returns the escaped character.
506
+ */
507
+ function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
508
+ if (leadingChar) {
509
+ chr = regexpEscapes[chr];
510
+ } else if (whitespaceChar) {
511
+ chr = stringEscapes[chr];
512
+ }
513
+ return '\\' + chr;
514
+ }
515
+
516
+ /**
517
+ * Used by `_.template` to escape characters for inclusion in compiled string literals.
512
518
  *
513
519
  * @private
514
520
  * @param {string} chr The matched character to escape.
@@ -740,9 +746,6 @@
740
746
  objectProto = Object.prototype,
741
747
  stringProto = String.prototype;
742
748
 
743
- /** Used to detect DOM support. */
744
- var document = (document = context.window) ? document.document : null;
745
-
746
749
  /** Used to resolve the decompiled source of functions. */
747
750
  var fnToString = Function.prototype.toString;
748
751
 
@@ -753,57 +756,42 @@
753
756
  var idCounter = 0;
754
757
 
755
758
  /**
756
- * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
759
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
757
760
  * of values.
758
761
  */
759
762
  var objToString = objectProto.toString;
760
763
 
761
764
  /** Used to restore the original `_` reference in `_.noConflict`. */
762
- var oldDash = context._;
765
+ var oldDash = root._;
763
766
 
764
767
  /** Used to detect if a method is native. */
765
768
  var reIsNative = RegExp('^' +
766
- escapeRegExp(fnToString.call(hasOwnProperty))
769
+ fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
767
770
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
768
771
  );
769
772
 
770
773
  /** Native method references. */
771
- var ArrayBuffer = getNative(context, 'ArrayBuffer'),
772
- bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'),
773
- ceil = Math.ceil,
774
+ var ArrayBuffer = context.ArrayBuffer,
774
775
  clearTimeout = context.clearTimeout,
775
- floor = Math.floor,
776
- getPrototypeOf = getNative(Object, 'getPrototypeOf'),
777
776
  parseFloat = context.parseFloat,
778
- push = arrayProto.push,
777
+ pow = Math.pow,
779
778
  propertyIsEnumerable = objectProto.propertyIsEnumerable,
780
779
  Set = getNative(context, 'Set'),
781
780
  setTimeout = context.setTimeout,
782
781
  splice = arrayProto.splice,
783
- Uint8Array = getNative(context, 'Uint8Array'),
782
+ Uint8Array = context.Uint8Array,
784
783
  WeakMap = getNative(context, 'WeakMap');
785
784
 
786
- /** Used to clone array buffers. */
787
- var Float64Array = (function() {
788
- // Safari 5 errors when using an array buffer to initialize a typed array
789
- // where the array buffer's `byteLength` is not a multiple of the typed
790
- // array's `BYTES_PER_ELEMENT`.
791
- try {
792
- var func = getNative(context, 'Float64Array'),
793
- result = new func(new ArrayBuffer(10), 0, 1) && func;
794
- } catch(e) {}
795
- return result || null;
796
- }());
797
-
798
785
  /* Native method references for those with the same name as other `lodash` methods. */
799
- var nativeCreate = getNative(Object, 'create'),
786
+ var nativeCeil = Math.ceil,
787
+ nativeCreate = getNative(Object, 'create'),
788
+ nativeFloor = Math.floor,
800
789
  nativeIsArray = getNative(Array, 'isArray'),
801
790
  nativeIsFinite = context.isFinite,
802
791
  nativeKeys = getNative(Object, 'keys'),
803
792
  nativeMax = Math.max,
804
793
  nativeMin = Math.min,
805
794
  nativeNow = getNative(Date, 'now'),
806
- nativeNumIsFinite = getNative(Number, 'isFinite'),
807
795
  nativeParseInt = context.parseInt,
808
796
  nativeRandom = Math.random;
809
797
 
@@ -816,11 +804,8 @@
816
804
  MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
817
805
  HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
818
806
 
819
- /** Used as the size, in bytes, of each `Float64Array` element. */
820
- var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0;
821
-
822
807
  /**
823
- * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
808
+ * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
824
809
  * of an array-like value.
825
810
  */
826
811
  var MAX_SAFE_INTEGER = 9007199254740991;
@@ -838,7 +823,7 @@
838
823
  ctorByTag[int8Tag] = context.Int8Array;
839
824
  ctorByTag[int16Tag] = context.Int16Array;
840
825
  ctorByTag[int32Tag] = context.Int32Array;
841
- ctorByTag[uint8Tag] = context.Uint8Array;
826
+ ctorByTag[uint8Tag] = Uint8Array;
842
827
  ctorByTag[uint8ClampedTag] = context.Uint8ClampedArray;
843
828
  ctorByTag[uint16Tag] = context.Uint16Array;
844
829
  ctorByTag[uint32Tag] = context.Uint32Array;
@@ -864,15 +849,16 @@
864
849
  /**
865
850
  * Creates a `lodash` object which wraps `value` to enable implicit chaining.
866
851
  * Methods that operate on and return arrays, collections, and functions can
867
- * be chained together. Methods that return a boolean or single value will
868
- * automatically end the chain returning the unwrapped value. Explicit chaining
869
- * may be enabled using `_.chain`. The execution of chained methods is lazy,
870
- * that is, execution is deferred until `_#value` is implicitly or explicitly
871
- * called.
852
+ * be chained together. Methods that retrieve a single value or may return a
853
+ * primitive value will automatically end the chain returning the unwrapped
854
+ * value. Explicit chaining may be enabled using `_.chain`. The execution of
855
+ * chained methods is lazy, that is, execution is deferred until `_#value`
856
+ * is implicitly or explicitly called.
872
857
  *
873
858
  * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
874
- * fusion is an optimization that merges iteratees to avoid creating intermediate
875
- * arrays and reduce the number of iteratee executions.
859
+ * fusion is an optimization strategy which merge iteratee calls; this can help
860
+ * to avoid the creation of intermediate data structures and greatly reduce the
861
+ * number of iteratee executions.
876
862
  *
877
863
  * Chaining is supported in custom builds as long as the `_#value` method is
878
864
  * directly or indirectly included in the build.
@@ -895,36 +881,37 @@
895
881
  * The chainable wrapper methods are:
896
882
  * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
897
883
  * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
898
- * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`,
899
- * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`,
900
- * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
901
- * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
902
- * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
903
- * `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
904
- * `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`,
905
- * `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`,
906
- * `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`,
907
- * `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`,
908
- * `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`,
909
- * `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
910
- * `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`,
911
- * `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`,
912
- * `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
884
+ * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
885
+ * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
886
+ * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
887
+ * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
888
+ * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
889
+ * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
890
+ * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
891
+ * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
892
+ * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
893
+ * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
894
+ * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
895
+ * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
896
+ * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
897
+ * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
898
+ * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
913
899
  *
914
900
  * The wrapper methods that are **not** chainable by default are:
915
- * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
916
- * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
917
- * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`,
918
- * `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
919
- * `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
920
- * `isFinite` `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
921
- * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
922
- * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
923
- * `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
924
- * `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
925
- * `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
926
- * `sortedLastIndex`, `startCase`, `startsWith`, `sum`, `template`, `trim`,
927
- * `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words`
901
+ * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
902
+ * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
903
+ * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
904
+ * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
905
+ * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
906
+ * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
907
+ * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
908
+ * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
909
+ * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
910
+ * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
911
+ * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
912
+ * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
913
+ * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
914
+ * `unescape`, `uniqueId`, `value`, and `words`
928
915
  *
929
916
  * The wrapper method `sample` will return a wrapped value when `n` is provided,
930
917
  * otherwise an unwrapped value is returned.
@@ -1007,15 +994,6 @@
1007
994
  Ctor.prototype = { 'valueOf': x, 'y': x };
1008
995
  for (var key in new Ctor) { props.push(key); }
1009
996
 
1010
- /**
1011
- * Detect if the `toStringTag` of `arguments` objects is resolvable
1012
- * (all but Firefox < 4, IE < 9).
1013
- *
1014
- * @memberOf _.support
1015
- * @type boolean
1016
- */
1017
- support.argsTag = objToString.call(arguments) == argsTag;
1018
-
1019
997
  /**
1020
998
  * Detect if `name` or `message` properties of `Error.prototype` are
1021
999
  * enumerable by default (IE < 9, Safari < 5.1).
@@ -1039,14 +1017,6 @@
1039
1017
  */
1040
1018
  support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
1041
1019
 
1042
- /**
1043
- * Detect if the `toStringTag` of DOM nodes is resolvable (all but IE < 9).
1044
- *
1045
- * @memberOf _.support
1046
- * @type boolean
1047
- */
1048
- support.nodeTag = objToString.call(document) != objectTag;
1049
-
1050
1020
  /**
1051
1021
  * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
1052
1022
  *
@@ -1091,18 +1061,6 @@
1091
1061
  * @type boolean
1092
1062
  */
1093
1063
  support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
1094
-
1095
- /**
1096
- * Detect if the DOM is supported.
1097
- *
1098
- * @memberOf _.support
1099
- * @type boolean
1100
- */
1101
- try {
1102
- support.dom = document.createDocumentFragment().nodeType === 11;
1103
- } catch(e) {
1104
- support.dom = false;
1105
- }
1106
1064
  }(1, 0));
1107
1065
 
1108
1066
  /**
@@ -1176,13 +1134,12 @@
1176
1134
  */
1177
1135
  function LazyWrapper(value) {
1178
1136
  this.__wrapped__ = value;
1179
- this.__actions__ = null;
1137
+ this.__actions__ = [];
1180
1138
  this.__dir__ = 1;
1181
- this.__dropCount__ = 0;
1182
1139
  this.__filtered__ = false;
1183
- this.__iteratees__ = null;
1140
+ this.__iteratees__ = [];
1184
1141
  this.__takeCount__ = POSITIVE_INFINITY;
1185
- this.__views__ = null;
1142
+ this.__views__ = [];
1186
1143
  }
1187
1144
 
1188
1145
  /**
@@ -1194,17 +1151,13 @@
1194
1151
  * @returns {Object} Returns the cloned `LazyWrapper` object.
1195
1152
  */
1196
1153
  function lazyClone() {
1197
- var actions = this.__actions__,
1198
- iteratees = this.__iteratees__,
1199
- views = this.__views__,
1200
- result = new LazyWrapper(this.__wrapped__);
1201
-
1202
- result.__actions__ = actions ? arrayCopy(actions) : null;
1154
+ var result = new LazyWrapper(this.__wrapped__);
1155
+ result.__actions__ = arrayCopy(this.__actions__);
1203
1156
  result.__dir__ = this.__dir__;
1204
1157
  result.__filtered__ = this.__filtered__;
1205
- result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
1158
+ result.__iteratees__ = arrayCopy(this.__iteratees__);
1206
1159
  result.__takeCount__ = this.__takeCount__;
1207
- result.__views__ = views ? arrayCopy(views) : null;
1160
+ result.__views__ = arrayCopy(this.__views__);
1208
1161
  return result;
1209
1162
  }
1210
1163
 
@@ -1237,22 +1190,25 @@
1237
1190
  * @returns {*} Returns the unwrapped value.
1238
1191
  */
1239
1192
  function lazyValue() {
1240
- var array = this.__wrapped__.value();
1241
- if (!isArray(array)) {
1242
- return baseWrapperValue(array, this.__actions__);
1243
- }
1244
- var dir = this.__dir__,
1193
+ var array = this.__wrapped__.value(),
1194
+ dir = this.__dir__,
1195
+ isArr = isArray(array),
1245
1196
  isRight = dir < 0,
1246
- view = getView(0, array.length, this.__views__),
1197
+ arrLength = isArr ? array.length : 0,
1198
+ view = getView(0, arrLength, this.__views__),
1247
1199
  start = view.start,
1248
1200
  end = view.end,
1249
1201
  length = end - start,
1250
1202
  index = isRight ? end : (start - 1),
1251
- takeCount = nativeMin(length, this.__takeCount__),
1252
1203
  iteratees = this.__iteratees__,
1253
- iterLength = iteratees ? iteratees.length : 0,
1204
+ iterLength = iteratees.length,
1254
1205
  resIndex = 0,
1255
- result = [];
1206
+ takeCount = nativeMin(length, this.__takeCount__);
1207
+
1208
+ if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
1209
+ return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
1210
+ }
1211
+ var result = [];
1256
1212
 
1257
1213
  outer:
1258
1214
  while (length-- && resIndex < takeCount) {
@@ -1264,30 +1220,16 @@
1264
1220
  while (++iterIndex < iterLength) {
1265
1221
  var data = iteratees[iterIndex],
1266
1222
  iteratee = data.iteratee,
1267
- type = data.type;
1223
+ type = data.type,
1224
+ computed = iteratee(value);
1268
1225
 
1269
- if (type == LAZY_DROP_WHILE_FLAG) {
1270
- if (data.done && (isRight ? (index > data.index) : (index < data.index))) {
1271
- data.count = 0;
1272
- data.done = false;
1273
- }
1274
- data.index = index;
1275
- if (!data.done) {
1276
- var limit = data.limit;
1277
- if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) {
1278
- continue outer;
1279
- }
1280
- }
1281
- } else {
1282
- var computed = iteratee(value);
1283
- if (type == LAZY_MAP_FLAG) {
1284
- value = computed;
1285
- } else if (!computed) {
1286
- if (type == LAZY_FILTER_FLAG) {
1287
- continue outer;
1288
- } else {
1289
- break outer;
1290
- }
1226
+ if (type == LAZY_MAP_FLAG) {
1227
+ value = computed;
1228
+ } else if (!computed) {
1229
+ if (type == LAZY_FILTER_FLAG) {
1230
+ continue outer;
1231
+ } else {
1232
+ break outer;
1291
1233
  }
1292
1234
  }
1293
1235
  }
@@ -1419,6 +1361,30 @@
1419
1361
 
1420
1362
  /*------------------------------------------------------------------------*/
1421
1363
 
1364
+ /**
1365
+ * Creates a new array joining `array` with `other`.
1366
+ *
1367
+ * @private
1368
+ * @param {Array} array The array to join.
1369
+ * @param {Array} other The other array to join.
1370
+ * @returns {Array} Returns the new concatenated array.
1371
+ */
1372
+ function arrayConcat(array, other) {
1373
+ var index = -1,
1374
+ length = array.length,
1375
+ othIndex = -1,
1376
+ othLength = other.length,
1377
+ result = Array(length + othLength);
1378
+
1379
+ while (++index < length) {
1380
+ result[index] = array[index];
1381
+ }
1382
+ while (++othIndex < othLength) {
1383
+ result[index++] = other[othIndex];
1384
+ }
1385
+ return result;
1386
+ }
1387
+
1422
1388
  /**
1423
1389
  * Copies the values of `source` to `array`.
1424
1390
  *
@@ -1574,6 +1540,25 @@
1574
1540
  return result;
1575
1541
  }
1576
1542
 
1543
+ /**
1544
+ * Appends the elements of `values` to `array`.
1545
+ *
1546
+ * @private
1547
+ * @param {Array} array The array to modify.
1548
+ * @param {Array} values The values to append.
1549
+ * @returns {Array} Returns `array`.
1550
+ */
1551
+ function arrayPush(array, values) {
1552
+ var index = -1,
1553
+ length = values.length,
1554
+ offset = array.length;
1555
+
1556
+ while (++index < length) {
1557
+ array[offset + index] = values[index];
1558
+ }
1559
+ return array;
1560
+ }
1561
+
1577
1562
  /**
1578
1563
  * A specialized version of `_.reduce` for arrays without support for callback
1579
1564
  * shorthands and `this` binding.
@@ -1645,18 +1630,20 @@
1645
1630
  }
1646
1631
 
1647
1632
  /**
1648
- * A specialized version of `_.sum` for arrays without support for iteratees.
1633
+ * A specialized version of `_.sum` for arrays without support for callback
1634
+ * shorthands and `this` binding..
1649
1635
  *
1650
1636
  * @private
1651
1637
  * @param {Array} array The array to iterate over.
1638
+ * @param {Function} iteratee The function invoked per iteration.
1652
1639
  * @returns {number} Returns the sum.
1653
1640
  */
1654
- function arraySum(array) {
1641
+ function arraySum(array, iteratee) {
1655
1642
  var length = array.length,
1656
1643
  result = 0;
1657
1644
 
1658
1645
  while (length--) {
1659
- result += +array[length] || 0;
1646
+ result += +iteratee(array[length]) || 0;
1660
1647
  }
1661
1648
  return result;
1662
1649
  }
@@ -1863,7 +1850,7 @@
1863
1850
  : (object ? value : {});
1864
1851
  }
1865
1852
  }
1866
- // Check for circular references and return corresponding clone.
1853
+ // Check for circular references and return its corresponding clone.
1867
1854
  stackA || (stackA = []);
1868
1855
  stackB || (stackB = []);
1869
1856
 
@@ -1898,7 +1885,7 @@
1898
1885
  if (isObject(prototype)) {
1899
1886
  object.prototype = prototype;
1900
1887
  var result = new object;
1901
- object.prototype = null;
1888
+ object.prototype = undefined;
1902
1889
  }
1903
1890
  return result || {};
1904
1891
  };
@@ -1940,7 +1927,7 @@
1940
1927
  var index = -1,
1941
1928
  indexOf = getIndexOf(),
1942
1929
  isCommon = indexOf == baseIndexOf,
1943
- cache = (isCommon && values.length >= 200) ? createCache(values) : null,
1930
+ cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
1944
1931
  valuesLength = values.length;
1945
1932
 
1946
1933
  if (cache) {
@@ -2116,13 +2103,14 @@
2116
2103
  * @param {Array} array The array to flatten.
2117
2104
  * @param {boolean} [isDeep] Specify a deep flatten.
2118
2105
  * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
2106
+ * @param {Array} [result=[]] The initial result value.
2119
2107
  * @returns {Array} Returns the new flattened array.
2120
2108
  */
2121
- function baseFlatten(array, isDeep, isStrict) {
2109
+ function baseFlatten(array, isDeep, isStrict, result) {
2110
+ result || (result = []);
2111
+
2122
2112
  var index = -1,
2123
- length = array.length,
2124
- resIndex = -1,
2125
- result = [];
2113
+ length = array.length;
2126
2114
 
2127
2115
  while (++index < length) {
2128
2116
  var value = array[index];
@@ -2130,16 +2118,12 @@
2130
2118
  (isStrict || isArray(value) || isArguments(value))) {
2131
2119
  if (isDeep) {
2132
2120
  // Recursively flatten arrays (susceptible to call stack limits).
2133
- value = baseFlatten(value, isDeep, isStrict);
2134
- }
2135
- var valIndex = -1,
2136
- valLength = value.length;
2137
-
2138
- while (++valIndex < valLength) {
2139
- result[++resIndex] = value[valIndex];
2121
+ baseFlatten(value, isDeep, isStrict, result);
2122
+ } else {
2123
+ arrayPush(result, value);
2140
2124
  }
2141
2125
  } else if (!isStrict) {
2142
- result[++resIndex] = value;
2126
+ result[result.length] = value;
2143
2127
  }
2144
2128
  }
2145
2129
  return result;
@@ -2496,7 +2480,7 @@
2496
2480
  * @private
2497
2481
  * @param {Object} object The destination object.
2498
2482
  * @param {Object} source The source object.
2499
- * @param {Function} [customizer] The function to customize merging properties.
2483
+ * @param {Function} [customizer] The function to customize merged values.
2500
2484
  * @param {Array} [stackA=[]] Tracks traversed source objects.
2501
2485
  * @param {Array} [stackB=[]] Associates values with source counterparts.
2502
2486
  * @returns {Object} Returns `object`.
@@ -2506,7 +2490,7 @@
2506
2490
  return object;
2507
2491
  }
2508
2492
  var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
2509
- props = isSrcArr ? null : keys(source);
2493
+ props = isSrcArr ? undefined : keys(source);
2510
2494
 
2511
2495
  arrayEach(props || source, function(srcValue, key) {
2512
2496
  if (props) {
@@ -2545,7 +2529,7 @@
2545
2529
  * @param {Object} source The source object.
2546
2530
  * @param {string} key The key of the value to merge.
2547
2531
  * @param {Function} mergeFunc The function to merge values.
2548
- * @param {Function} [customizer] The function to customize merging properties.
2532
+ * @param {Function} [customizer] The function to customize merged values.
2549
2533
  * @param {Array} [stackA=[]] Tracks traversed source objects.
2550
2534
  * @param {Array} [stackB=[]] Associates values with source counterparts.
2551
2535
  * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
@@ -2652,7 +2636,7 @@
2652
2636
  * @returns {number} Returns the random number.
2653
2637
  */
2654
2638
  function baseRandom(min, max) {
2655
- return min + floor(nativeRandom() * (max - min + 1));
2639
+ return min + nativeFloor(nativeRandom() * (max - min + 1));
2656
2640
  }
2657
2641
 
2658
2642
  /**
@@ -2818,7 +2802,7 @@
2818
2802
  indexOf = getIndexOf(),
2819
2803
  length = array.length,
2820
2804
  isCommon = indexOf == baseIndexOf,
2821
- isLarge = isCommon && length >= 200,
2805
+ isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
2822
2806
  seen = isLarge ? createCache() : null,
2823
2807
  result = [];
2824
2808
 
@@ -2917,11 +2901,8 @@
2917
2901
  length = actions.length;
2918
2902
 
2919
2903
  while (++index < length) {
2920
- var args = [result],
2921
- action = actions[index];
2922
-
2923
- push.apply(args, action.args);
2924
- result = action.func.apply(action.thisArg, args);
2904
+ var action = actions[index];
2905
+ result = action.func.apply(action.thisArg, arrayPush([result], action.args));
2925
2906
  }
2926
2907
  return result;
2927
2908
  }
@@ -2980,7 +2961,7 @@
2980
2961
  valIsUndef = value === undefined;
2981
2962
 
2982
2963
  while (low < high) {
2983
- var mid = floor((low + high) / 2),
2964
+ var mid = nativeFloor((low + high) / 2),
2984
2965
  computed = iteratee(array[mid]),
2985
2966
  isDef = computed !== undefined,
2986
2967
  isReflexive = computed === computed;
@@ -3049,26 +3030,11 @@
3049
3030
  * @returns {ArrayBuffer} Returns the cloned array buffer.
3050
3031
  */
3051
3032
  function bufferClone(buffer) {
3052
- return bufferSlice.call(buffer, 0);
3053
- }
3054
- if (!bufferSlice) {
3055
- // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`.
3056
- bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) {
3057
- var byteLength = buffer.byteLength,
3058
- floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0,
3059
- offset = floatLength * FLOAT64_BYTES_PER_ELEMENT,
3060
- result = new ArrayBuffer(byteLength);
3033
+ var result = new ArrayBuffer(buffer.byteLength),
3034
+ view = new Uint8Array(result);
3061
3035
 
3062
- if (floatLength) {
3063
- var view = new Float64Array(result, 0, floatLength);
3064
- view.set(new Float64Array(buffer, 0, floatLength));
3065
- }
3066
- if (byteLength != offset) {
3067
- view = new Uint8Array(result, offset);
3068
- view.set(new Uint8Array(buffer, offset));
3069
- }
3070
- return result;
3071
- };
3036
+ view.set(new Uint8Array(buffer));
3037
+ return result;
3072
3038
  }
3073
3039
 
3074
3040
  /**
@@ -3087,7 +3053,7 @@
3087
3053
  argsLength = nativeMax(args.length - holdersLength, 0),
3088
3054
  leftIndex = -1,
3089
3055
  leftLength = partials.length,
3090
- result = Array(argsLength + leftLength);
3056
+ result = Array(leftLength + argsLength);
3091
3057
 
3092
3058
  while (++leftIndex < leftLength) {
3093
3059
  result[leftIndex] = partials[leftIndex];
@@ -3134,12 +3100,7 @@
3134
3100
  }
3135
3101
 
3136
3102
  /**
3137
- * Creates a function that aggregates a collection, creating an accumulator
3138
- * object composed from the results of running each element in the collection
3139
- * through an iteratee.
3140
- *
3141
- * **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`,
3142
- * and `_.partition`.
3103
+ * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
3143
3104
  *
3144
3105
  * @private
3145
3106
  * @param {Function} setter The function to set keys and values of the accumulator object.
@@ -3169,10 +3130,7 @@
3169
3130
  }
3170
3131
 
3171
3132
  /**
3172
- * Creates a function that assigns properties of source object(s) to a given
3173
- * destination object.
3174
- *
3175
- * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`.
3133
+ * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
3176
3134
  *
3177
3135
  * @private
3178
3136
  * @param {Function} assigner The function to assign values.
@@ -3283,9 +3241,9 @@
3283
3241
  * @param {Array} [values] The values to cache.
3284
3242
  * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
3285
3243
  */
3286
- var createCache = !(nativeCreate && Set) ? constant(null) : function(values) {
3287
- return new SetCache(values);
3288
- };
3244
+ function createCache(values) {
3245
+ return (nativeCreate && Set) ? new SetCache(values) : null;
3246
+ }
3289
3247
 
3290
3248
  /**
3291
3249
  * Creates a function that produces compound words out of the words in a
@@ -3320,7 +3278,7 @@
3320
3278
  function createCtorWrapper(Ctor) {
3321
3279
  return function() {
3322
3280
  // Use a `switch` statement to work with class constructors.
3323
- // See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist
3281
+ // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
3324
3282
  // for more details.
3325
3283
  var args = arguments;
3326
3284
  switch (args.length) {
@@ -3330,6 +3288,8 @@
3330
3288
  case 3: return new Ctor(args[0], args[1], args[2]);
3331
3289
  case 4: return new Ctor(args[0], args[1], args[2], args[3]);
3332
3290
  case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
3291
+ case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
3292
+ case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
3333
3293
  }
3334
3294
  var thisBinding = baseCreate(Ctor.prototype),
3335
3295
  result = Ctor.apply(thisBinding, args);
@@ -3350,15 +3310,34 @@
3350
3310
  function createCurry(flag) {
3351
3311
  function curryFunc(func, arity, guard) {
3352
3312
  if (guard && isIterateeCall(func, arity, guard)) {
3353
- arity = null;
3313
+ arity = undefined;
3354
3314
  }
3355
- var result = createWrapper(func, flag, null, null, null, null, null, arity);
3315
+ var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
3356
3316
  result.placeholder = curryFunc.placeholder;
3357
3317
  return result;
3358
3318
  }
3359
3319
  return curryFunc;
3360
3320
  }
3361
3321
 
3322
+ /**
3323
+ * Creates a `_.defaults` or `_.defaultsDeep` function.
3324
+ *
3325
+ * @private
3326
+ * @param {Function} assigner The function to assign values.
3327
+ * @param {Function} customizer The function to customize assigned values.
3328
+ * @returns {Function} Returns the new defaults function.
3329
+ */
3330
+ function createDefaults(assigner, customizer) {
3331
+ return restParam(function(args) {
3332
+ var object = args[0];
3333
+ if (object == null) {
3334
+ return object;
3335
+ }
3336
+ args.push(customizer);
3337
+ return assigner.apply(undefined, args);
3338
+ });
3339
+ }
3340
+
3362
3341
  /**
3363
3342
  * Creates a `_.max` or `_.min` function.
3364
3343
  *
@@ -3370,11 +3349,11 @@
3370
3349
  function createExtremum(comparator, exValue) {
3371
3350
  return function(collection, iteratee, thisArg) {
3372
3351
  if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
3373
- iteratee = null;
3352
+ iteratee = undefined;
3374
3353
  }
3375
3354
  iteratee = getCallback(iteratee, thisArg, 3);
3376
3355
  if (iteratee.length == 1) {
3377
- collection = toIterable(collection);
3356
+ collection = isArray(collection) ? collection : toIterable(collection);
3378
3357
  var result = arrayExtremum(collection, iteratee, comparator, exValue);
3379
3358
  if (!(collection.length && result === exValue)) {
3380
3359
  return result;
@@ -3455,7 +3434,7 @@
3455
3434
  throw new TypeError(FUNC_ERROR_TEXT);
3456
3435
  }
3457
3436
  if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
3458
- wrapper = new LodashWrapper([]);
3437
+ wrapper = new LodashWrapper([], true);
3459
3438
  }
3460
3439
  }
3461
3440
  index = wrapper ? -1 : length;
@@ -3463,7 +3442,7 @@
3463
3442
  func = funcs[index];
3464
3443
 
3465
3444
  var funcName = getFuncName(func),
3466
- data = funcName == 'wrapper' ? getData(func) : null;
3445
+ data = funcName == 'wrapper' ? getData(func) : undefined;
3467
3446
 
3468
3447
  if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
3469
3448
  wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
@@ -3472,12 +3451,14 @@
3472
3451
  }
3473
3452
  }
3474
3453
  return function() {
3475
- var args = arguments;
3476
- if (wrapper && args.length == 1 && isArray(args[0])) {
3477
- return wrapper.plant(args[0]).value();
3454
+ var args = arguments,
3455
+ value = args[0];
3456
+
3457
+ if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
3458
+ return wrapper.plant(value).value();
3478
3459
  }
3479
3460
  var index = 0,
3480
- result = length ? funcs[index].apply(this, args) : args[0];
3461
+ result = length ? funcs[index].apply(this, args) : value;
3481
3462
 
3482
3463
  while (++index < length) {
3483
3464
  result = funcs[index].call(this, result);
@@ -3581,7 +3562,7 @@
3581
3562
  function createPartial(flag) {
3582
3563
  var partialFunc = restParam(function(func, partials) {
3583
3564
  var holders = replaceHolders(partials, partialFunc.placeholder);
3584
- return createWrapper(func, flag, null, partials, holders);
3565
+ return createWrapper(func, flag, undefined, partials, holders);
3585
3566
  });
3586
3567
  return partialFunc;
3587
3568
  }
@@ -3627,7 +3608,7 @@
3627
3608
  isCurry = bitmask & CURRY_FLAG,
3628
3609
  isCurryBound = bitmask & CURRY_BOUND_FLAG,
3629
3610
  isCurryRight = bitmask & CURRY_RIGHT_FLAG,
3630
- Ctor = isBindKey ? null : createCtorWrapper(func);
3611
+ Ctor = isBindKey ? undefined : createCtorWrapper(func);
3631
3612
 
3632
3613
  function wrapper() {
3633
3614
  // Avoid `arguments` object use disqualifying optimizations by
@@ -3651,12 +3632,12 @@
3651
3632
 
3652
3633
  length -= argsHolders.length;
3653
3634
  if (length < arity) {
3654
- var newArgPos = argPos ? arrayCopy(argPos) : null,
3635
+ var newArgPos = argPos ? arrayCopy(argPos) : undefined,
3655
3636
  newArity = nativeMax(arity - length, 0),
3656
- newsHolders = isCurry ? argsHolders : null,
3657
- newHoldersRight = isCurry ? null : argsHolders,
3658
- newPartials = isCurry ? args : null,
3659
- newPartialsRight = isCurry ? null : args;
3637
+ newsHolders = isCurry ? argsHolders : undefined,
3638
+ newHoldersRight = isCurry ? undefined : argsHolders,
3639
+ newPartials = isCurry ? args : undefined,
3640
+ newPartialsRight = isCurry ? undefined : args;
3660
3641
 
3661
3642
  bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
3662
3643
  bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
@@ -3710,7 +3691,7 @@
3710
3691
  }
3711
3692
  var padLength = length - strLength;
3712
3693
  chars = chars == null ? ' ' : (chars + '');
3713
- return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
3694
+ return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
3714
3695
  }
3715
3696
 
3716
3697
  /**
@@ -3736,7 +3717,7 @@
3736
3717
  argsLength = arguments.length,
3737
3718
  leftIndex = -1,
3738
3719
  leftLength = partials.length,
3739
- args = Array(argsLength + leftLength);
3720
+ args = Array(leftLength + argsLength);
3740
3721
 
3741
3722
  while (++leftIndex < leftLength) {
3742
3723
  args[leftIndex] = partials[leftIndex];
@@ -3750,6 +3731,25 @@
3750
3731
  return wrapper;
3751
3732
  }
3752
3733
 
3734
+ /**
3735
+ * Creates a `_.ceil`, `_.floor`, or `_.round` function.
3736
+ *
3737
+ * @private
3738
+ * @param {string} methodName The name of the `Math` method to use when rounding.
3739
+ * @returns {Function} Returns the new round function.
3740
+ */
3741
+ function createRound(methodName) {
3742
+ var func = Math[methodName];
3743
+ return function(number, precision) {
3744
+ precision = precision === undefined ? 0 : (+precision || 0);
3745
+ if (precision) {
3746
+ precision = pow(10, precision);
3747
+ return func(number * precision) / precision;
3748
+ }
3749
+ return func(number);
3750
+ };
3751
+ }
3752
+
3753
3753
  /**
3754
3754
  * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
3755
3755
  *
@@ -3799,16 +3799,16 @@
3799
3799
  var length = partials ? partials.length : 0;
3800
3800
  if (!length) {
3801
3801
  bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
3802
- partials = holders = null;
3802
+ partials = holders = undefined;
3803
3803
  }
3804
3804
  length -= (holders ? holders.length : 0);
3805
3805
  if (bitmask & PARTIAL_RIGHT_FLAG) {
3806
3806
  var partialsRight = partials,
3807
3807
  holdersRight = holders;
3808
3808
 
3809
- partials = holders = null;
3809
+ partials = holders = undefined;
3810
3810
  }
3811
- var data = isBindKey ? null : getData(func),
3811
+ var data = isBindKey ? undefined : getData(func),
3812
3812
  newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
3813
3813
 
3814
3814
  if (data) {
@@ -3887,7 +3887,7 @@
3887
3887
  * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
3888
3888
  *
3889
3889
  * @private
3890
- * @param {Object} value The object to compare.
3890
+ * @param {Object} object The object to compare.
3891
3891
  * @param {Object} other The other object to compare.
3892
3892
  * @param {string} tag The `toStringTag` of the objects to compare.
3893
3893
  * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
@@ -4087,13 +4087,13 @@
4087
4087
  * @private
4088
4088
  * @param {number} start The start of the view.
4089
4089
  * @param {number} end The end of the view.
4090
- * @param {Array} [transforms] The transformations to apply to the view.
4090
+ * @param {Array} transforms The transformations to apply to the view.
4091
4091
  * @returns {Object} Returns an object containing the `start` and `end`
4092
4092
  * positions of the view.
4093
4093
  */
4094
4094
  function getView(start, end, transforms) {
4095
4095
  var index = -1,
4096
- length = transforms ? transforms.length : 0;
4096
+ length = transforms.length;
4097
4097
 
4098
4098
  while (++index < length) {
4099
4099
  var data = transforms[index],
@@ -4296,7 +4296,7 @@
4296
4296
  /**
4297
4297
  * Checks if `value` is a valid array-like length.
4298
4298
  *
4299
- * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
4299
+ * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
4300
4300
  *
4301
4301
  * @private
4302
4302
  * @param {*} value The value to check.
@@ -4388,6 +4388,18 @@
4388
4388
  return data;
4389
4389
  }
4390
4390
 
4391
+ /**
4392
+ * Used by `_.defaultsDeep` to customize its `_.merge` use.
4393
+ *
4394
+ * @private
4395
+ * @param {*} objectValue The destination object property value.
4396
+ * @param {*} sourceValue The source object property value.
4397
+ * @returns {*} Returns the value to assign to the destination object.
4398
+ */
4399
+ function mergeDefaults(objectValue, sourceValue) {
4400
+ return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
4401
+ }
4402
+
4391
4403
  /**
4392
4404
  * A specialized version of `_.pick` which picks `object` properties specified
4393
4405
  * by `props`.
@@ -4487,46 +4499,6 @@
4487
4499
  };
4488
4500
  }());
4489
4501
 
4490
- /**
4491
- * A fallback implementation of `_.isPlainObject` which checks if `value`
4492
- * is an object created by the `Object` constructor or has a `[[Prototype]]`
4493
- * of `null`.
4494
- *
4495
- * @private
4496
- * @param {*} value The value to check.
4497
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
4498
- */
4499
- function shimIsPlainObject(value) {
4500
- var Ctor,
4501
- support = lodash.support;
4502
-
4503
- // Exit early for non `Object` objects.
4504
- if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value)) ||
4505
- (!hasOwnProperty.call(value, 'constructor') &&
4506
- (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor))) ||
4507
- (!support.argsTag && isArguments(value))) {
4508
- return false;
4509
- }
4510
- // IE < 9 iterates inherited properties before own properties. If the first
4511
- // iterated property is an object's own property then there are no inherited
4512
- // enumerable properties.
4513
- var result;
4514
- if (support.ownLast) {
4515
- baseForIn(value, function(subValue, key, object) {
4516
- result = hasOwnProperty.call(object, key);
4517
- return false;
4518
- });
4519
- return result !== false;
4520
- }
4521
- // In most environments an object's own properties are iterated before
4522
- // its inherited properties. If the last iterated property is an object's
4523
- // own property then there are no inherited enumerable properties.
4524
- baseForIn(value, function(subValue, key) {
4525
- result = key;
4526
- });
4527
- return result === undefined || hasOwnProperty.call(value, result);
4528
- }
4529
-
4530
4502
  /**
4531
4503
  * A fallback implementation of `Object.keys` which creates an array of the
4532
4504
  * own enumerable property names of `object`.
@@ -4653,12 +4625,12 @@
4653
4625
  if (guard ? isIterateeCall(array, size, guard) : size == null) {
4654
4626
  size = 1;
4655
4627
  } else {
4656
- size = nativeMax(+size || 1, 1);
4628
+ size = nativeMax(nativeFloor(size) || 1, 1);
4657
4629
  }
4658
4630
  var index = 0,
4659
4631
  length = array ? array.length : 0,
4660
4632
  resIndex = -1,
4661
- result = Array(ceil(length / size));
4633
+ result = Array(nativeCeil(length / size));
4662
4634
 
4663
4635
  while (index < length) {
4664
4636
  result[++resIndex] = baseSlice(array, index, (index += size));
@@ -4697,7 +4669,7 @@
4697
4669
 
4698
4670
  /**
4699
4671
  * Creates an array of unique `array` values not included in the other
4700
- * provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
4672
+ * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
4701
4673
  * for equality comparisons.
4702
4674
  *
4703
4675
  * @static
@@ -4712,7 +4684,7 @@
4712
4684
  * // => [1, 3]
4713
4685
  */
4714
4686
  var difference = restParam(function(array, values) {
4715
- return isArrayLike(array)
4687
+ return (isObjectLike(array) && isArrayLike(array))
4716
4688
  ? baseDifference(array, baseFlatten(values, false, true))
4717
4689
  : [];
4718
4690
  });
@@ -5107,7 +5079,7 @@
5107
5079
 
5108
5080
  /**
5109
5081
  * Gets the index at which the first occurrence of `value` is found in `array`
5110
- * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5082
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5111
5083
  * for equality comparisons. If `fromIndex` is negative, it is used as the offset
5112
5084
  * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
5113
5085
  * performs a faster binary search.
@@ -5141,10 +5113,9 @@
5141
5113
  if (typeof fromIndex == 'number') {
5142
5114
  fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
5143
5115
  } else if (fromIndex) {
5144
- var index = binaryIndex(array, value),
5145
- other = array[index];
5146
-
5147
- if (value === value ? (value === other) : (other !== other)) {
5116
+ var index = binaryIndex(array, value);
5117
+ if (index < length &&
5118
+ (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
5148
5119
  return index;
5149
5120
  }
5150
5121
  return -1;
@@ -5171,7 +5142,7 @@
5171
5142
 
5172
5143
  /**
5173
5144
  * Creates an array of unique values that are included in all of the provided
5174
- * arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5145
+ * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5175
5146
  * for equality comparisons.
5176
5147
  *
5177
5148
  * @static
@@ -5292,7 +5263,7 @@
5292
5263
 
5293
5264
  /**
5294
5265
  * Removes all provided values from `array` using
5295
- * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5266
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5296
5267
  * for equality comparisons.
5297
5268
  *
5298
5269
  * **Note:** Unlike `_.without`, this method mutates `array`.
@@ -5725,7 +5696,7 @@
5725
5696
 
5726
5697
  /**
5727
5698
  * Creates an array of unique values, in order, from all of the provided arrays
5728
- * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5699
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5729
5700
  * for equality comparisons.
5730
5701
  *
5731
5702
  * @static
@@ -5744,7 +5715,7 @@
5744
5715
 
5745
5716
  /**
5746
5717
  * Creates a duplicate-free version of an array, using
5747
- * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5718
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5748
5719
  * for equality comparisons, in which only the first occurence of each element
5749
5720
  * is kept. Providing `true` for `isSorted` performs a faster search algorithm
5750
5721
  * for sorted arrays. If an iteratee function is provided it is invoked for
@@ -5798,7 +5769,7 @@
5798
5769
  }
5799
5770
  if (isSorted != null && typeof isSorted != 'boolean') {
5800
5771
  thisArg = iteratee;
5801
- iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted;
5772
+ iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
5802
5773
  isSorted = false;
5803
5774
  }
5804
5775
  var callback = getCallback();
@@ -5885,7 +5856,7 @@
5885
5856
 
5886
5857
  /**
5887
5858
  * Creates an array excluding all provided values using
5888
- * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5859
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
5889
5860
  * for equality comparisons.
5890
5861
  *
5891
5862
  * @static
@@ -5927,7 +5898,7 @@
5927
5898
  var array = arguments[index];
5928
5899
  if (isArrayLike(array)) {
5929
5900
  var result = result
5930
- ? baseDifference(result, array).concat(baseDifference(array, result))
5901
+ ? arrayPush(baseDifference(result, array), baseDifference(array, result))
5931
5902
  : array;
5932
5903
  }
5933
5904
  }
@@ -6149,16 +6120,16 @@
6149
6120
  * @example
6150
6121
  *
6151
6122
  * var array = [1, 2];
6152
- * var wrapper = _(array).push(3);
6123
+ * var wrapped = _(array).push(3);
6153
6124
  *
6154
6125
  * console.log(array);
6155
6126
  * // => [1, 2]
6156
6127
  *
6157
- * wrapper = wrapper.commit();
6128
+ * wrapped = wrapped.commit();
6158
6129
  * console.log(array);
6159
6130
  * // => [1, 2, 3]
6160
6131
  *
6161
- * wrapper.last();
6132
+ * wrapped.last();
6162
6133
  * // => 3
6163
6134
  *
6164
6135
  * console.log(array);
@@ -6168,6 +6139,33 @@
6168
6139
  return new LodashWrapper(this.value(), this.__chain__);
6169
6140
  }
6170
6141
 
6142
+ /**
6143
+ * Creates a new array joining a wrapped array with any additional arrays
6144
+ * and/or values.
6145
+ *
6146
+ * @name concat
6147
+ * @memberOf _
6148
+ * @category Chain
6149
+ * @param {...*} [values] The values to concatenate.
6150
+ * @returns {Array} Returns the new concatenated array.
6151
+ * @example
6152
+ *
6153
+ * var array = [1];
6154
+ * var wrapped = _(array).concat(2, [3], [[4]]);
6155
+ *
6156
+ * console.log(wrapped.value());
6157
+ * // => [1, 2, 3, [4]]
6158
+ *
6159
+ * console.log(array);
6160
+ * // => [1]
6161
+ */
6162
+ var wrapperConcat = restParam(function(values) {
6163
+ values = baseFlatten(values);
6164
+ return this.thru(function(array) {
6165
+ return arrayConcat(isArray(array) ? array : [toObject(array)], values);
6166
+ });
6167
+ });
6168
+
6171
6169
  /**
6172
6170
  * Creates a clone of the chained sequence planting `value` as the wrapped value.
6173
6171
  *
@@ -6178,17 +6176,17 @@
6178
6176
  * @example
6179
6177
  *
6180
6178
  * var array = [1, 2];
6181
- * var wrapper = _(array).map(function(value) {
6179
+ * var wrapped = _(array).map(function(value) {
6182
6180
  * return Math.pow(value, 2);
6183
6181
  * });
6184
6182
  *
6185
6183
  * var other = [3, 4];
6186
- * var otherWrapper = wrapper.plant(other);
6184
+ * var otherWrapped = wrapped.plant(other);
6187
6185
  *
6188
- * otherWrapper.value();
6186
+ * otherWrapped.value();
6189
6187
  * // => [9, 16]
6190
6188
  *
6191
- * wrapper.value();
6189
+ * wrapped.value();
6192
6190
  * // => [1, 4]
6193
6191
  */
6194
6192
  function wrapperPlant(value) {
@@ -6231,15 +6229,20 @@
6231
6229
  */
6232
6230
  function wrapperReverse() {
6233
6231
  var value = this.__wrapped__;
6232
+
6233
+ var interceptor = function(value) {
6234
+ return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
6235
+ };
6234
6236
  if (value instanceof LazyWrapper) {
6237
+ var wrapped = value;
6235
6238
  if (this.__actions__.length) {
6236
- value = new LazyWrapper(this);
6239
+ wrapped = new LazyWrapper(this);
6237
6240
  }
6238
- return new LodashWrapper(value.reverse(), this.__chain__);
6241
+ wrapped = wrapped.reverse();
6242
+ wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
6243
+ return new LodashWrapper(wrapped, this.__chain__);
6239
6244
  }
6240
- return this.thru(function(value) {
6241
- return value.reverse();
6242
- });
6245
+ return this.thru(interceptor);
6243
6246
  }
6244
6247
 
6245
6248
  /**
@@ -6400,7 +6403,7 @@
6400
6403
  function every(collection, predicate, thisArg) {
6401
6404
  var func = isArray(collection) ? arrayEvery : baseEvery;
6402
6405
  if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
6403
- predicate = null;
6406
+ predicate = undefined;
6404
6407
  }
6405
6408
  if (typeof predicate != 'function' || thisArg !== undefined) {
6406
6409
  predicate = getCallback(predicate, thisArg, 3);
@@ -6674,7 +6677,7 @@
6674
6677
 
6675
6678
  /**
6676
6679
  * Checks if `value` is in `collection` using
6677
- * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
6680
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
6678
6681
  * for equality comparisons. If `fromIndex` is negative, it is used as the offset
6679
6682
  * from the end of `collection`.
6680
6683
  *
@@ -6707,17 +6710,14 @@
6707
6710
  collection = values(collection);
6708
6711
  length = collection.length;
6709
6712
  }
6710
- if (!length) {
6711
- return false;
6712
- }
6713
6713
  if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
6714
6714
  fromIndex = 0;
6715
6715
  } else {
6716
6716
  fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
6717
6717
  }
6718
6718
  return (typeof collection == 'string' || !isArray(collection) && isString(collection))
6719
- ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
6720
- : (getIndexOf(collection, target, fromIndex) > -1);
6719
+ ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
6720
+ : (!!length && getIndexOf(collection, target, fromIndex) > -1);
6721
6721
  }
6722
6722
 
6723
6723
  /**
@@ -6799,7 +6799,7 @@
6799
6799
  result = isArrayLike(collection) ? Array(collection.length) : [];
6800
6800
 
6801
6801
  baseEach(collection, function(value) {
6802
- var func = isFunc ? path : ((isProp && value != null) ? value[path] : null);
6802
+ var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
6803
6803
  result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
6804
6804
  });
6805
6805
  return result;
@@ -6969,7 +6969,8 @@
6969
6969
  * `_.reduce`, `_.reduceRight`, and `_.transform`.
6970
6970
  *
6971
6971
  * The guarded methods are:
6972
- * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder`
6972
+ * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,
6973
+ * and `sortByOrder`
6973
6974
  *
6974
6975
  * @static
6975
6976
  * @memberOf _
@@ -7199,7 +7200,7 @@
7199
7200
  function some(collection, predicate, thisArg) {
7200
7201
  var func = isArray(collection) ? arraySome : baseSome;
7201
7202
  if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
7202
- predicate = null;
7203
+ predicate = undefined;
7203
7204
  }
7204
7205
  if (typeof predicate != 'function' || thisArg !== undefined) {
7205
7206
  predicate = getCallback(predicate, thisArg, 3);
@@ -7260,7 +7261,7 @@
7260
7261
  return [];
7261
7262
  }
7262
7263
  if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
7263
- iteratee = null;
7264
+ iteratee = undefined;
7264
7265
  }
7265
7266
  var index = -1;
7266
7267
  iteratee = getCallback(iteratee, thisArg, 3);
@@ -7319,9 +7320,9 @@
7319
7320
 
7320
7321
  /**
7321
7322
  * This method is like `_.sortByAll` except that it allows specifying the
7322
- * sort orders of the iteratees to sort by. A truthy value in `orders` will
7323
- * sort the corresponding property name in ascending order while a falsey
7324
- * value will sort it in descending order.
7323
+ * sort orders of the iteratees to sort by. If `orders` is unspecified, all
7324
+ * values are sorted in ascending order. Otherwise, a value is sorted in
7325
+ * ascending order if its corresponding order is "asc", and descending if "desc".
7325
7326
  *
7326
7327
  * If a property name is provided for an iteratee the created `_.property`
7327
7328
  * style callback returns the property value of the given element.
@@ -7335,7 +7336,7 @@
7335
7336
  * @category Collection
7336
7337
  * @param {Array|Object|string} collection The collection to iterate over.
7337
7338
  * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
7338
- * @param {boolean[]} orders The sort orders of `iteratees`.
7339
+ * @param {boolean[]} [orders] The sort orders of `iteratees`.
7339
7340
  * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
7340
7341
  * @returns {Array} Returns the new sorted array.
7341
7342
  * @example
@@ -7348,7 +7349,7 @@
7348
7349
  * ];
7349
7350
  *
7350
7351
  * // sort by `user` in ascending order and by `age` in descending order
7351
- * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values);
7352
+ * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);
7352
7353
  * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
7353
7354
  */
7354
7355
  function sortByOrder(collection, iteratees, orders, guard) {
@@ -7356,7 +7357,7 @@
7356
7357
  return [];
7357
7358
  }
7358
7359
  if (guard && isIterateeCall(iteratees, orders, guard)) {
7359
- orders = null;
7360
+ orders = undefined;
7360
7361
  }
7361
7362
  if (!isArray(iteratees)) {
7362
7363
  iteratees = iteratees == null ? [] : [iteratees];
@@ -7481,10 +7482,10 @@
7481
7482
  */
7482
7483
  function ary(func, n, guard) {
7483
7484
  if (guard && isIterateeCall(func, n, guard)) {
7484
- n = null;
7485
+ n = undefined;
7485
7486
  }
7486
7487
  n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
7487
- return createWrapper(func, ARY_FLAG, null, null, null, null, n);
7488
+ return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
7488
7489
  }
7489
7490
 
7490
7491
  /**
@@ -7519,7 +7520,7 @@
7519
7520
  result = func.apply(this, arguments);
7520
7521
  }
7521
7522
  if (n <= 1) {
7522
- func = null;
7523
+ func = undefined;
7523
7524
  }
7524
7525
  return result;
7525
7526
  };
@@ -7827,9 +7828,9 @@
7827
7828
  var leading = true;
7828
7829
  trailing = false;
7829
7830
  } else if (isObject(options)) {
7830
- leading = options.leading;
7831
+ leading = !!options.leading;
7831
7832
  maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
7832
- trailing = 'trailing' in options ? options.trailing : trailing;
7833
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
7833
7834
  }
7834
7835
 
7835
7836
  function cancel() {
@@ -7839,41 +7840,35 @@
7839
7840
  if (maxTimeoutId) {
7840
7841
  clearTimeout(maxTimeoutId);
7841
7842
  }
7843
+ lastCalled = 0;
7842
7844
  maxTimeoutId = timeoutId = trailingCall = undefined;
7843
7845
  }
7844
7846
 
7847
+ function complete(isCalled, id) {
7848
+ if (id) {
7849
+ clearTimeout(id);
7850
+ }
7851
+ maxTimeoutId = timeoutId = trailingCall = undefined;
7852
+ if (isCalled) {
7853
+ lastCalled = now();
7854
+ result = func.apply(thisArg, args);
7855
+ if (!timeoutId && !maxTimeoutId) {
7856
+ args = thisArg = undefined;
7857
+ }
7858
+ }
7859
+ }
7860
+
7845
7861
  function delayed() {
7846
7862
  var remaining = wait - (now() - stamp);
7847
7863
  if (remaining <= 0 || remaining > wait) {
7848
- if (maxTimeoutId) {
7849
- clearTimeout(maxTimeoutId);
7850
- }
7851
- var isCalled = trailingCall;
7852
- maxTimeoutId = timeoutId = trailingCall = undefined;
7853
- if (isCalled) {
7854
- lastCalled = now();
7855
- result = func.apply(thisArg, args);
7856
- if (!timeoutId && !maxTimeoutId) {
7857
- args = thisArg = null;
7858
- }
7859
- }
7864
+ complete(trailingCall, maxTimeoutId);
7860
7865
  } else {
7861
7866
  timeoutId = setTimeout(delayed, remaining);
7862
7867
  }
7863
7868
  }
7864
7869
 
7865
7870
  function maxDelayed() {
7866
- if (timeoutId) {
7867
- clearTimeout(timeoutId);
7868
- }
7869
- maxTimeoutId = timeoutId = trailingCall = undefined;
7870
- if (trailing || (maxWait !== wait)) {
7871
- lastCalled = now();
7872
- result = func.apply(thisArg, args);
7873
- if (!timeoutId && !maxTimeoutId) {
7874
- args = thisArg = null;
7875
- }
7876
- }
7871
+ complete(trailing, timeoutId);
7877
7872
  }
7878
7873
 
7879
7874
  function debounced() {
@@ -7913,7 +7908,7 @@
7913
7908
  result = func.apply(thisArg, args);
7914
7909
  }
7915
7910
  if (isCalled && !timeoutId && !maxTimeoutId) {
7916
- args = thisArg = null;
7911
+ args = thisArg = undefined;
7917
7912
  }
7918
7913
  return result;
7919
7914
  }
@@ -8018,7 +8013,7 @@
8018
8013
  *
8019
8014
  * **Note:** The cache is exposed as the `cache` property on the memoized
8020
8015
  * function. Its creation may be customized by replacing the `_.memoize.Cache`
8021
- * constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object)
8016
+ * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
8022
8017
  * method interface of `get`, `has`, and `set`.
8023
8018
  *
8024
8019
  * @static
@@ -8079,6 +8074,52 @@
8079
8074
  return memoized;
8080
8075
  }
8081
8076
 
8077
+ /**
8078
+ * Creates a function that runs each argument through a corresponding
8079
+ * transform function.
8080
+ *
8081
+ * @static
8082
+ * @memberOf _
8083
+ * @category Function
8084
+ * @param {Function} func The function to wrap.
8085
+ * @param {...(Function|Function[])} [transforms] The functions to transform
8086
+ * arguments, specified as individual functions or arrays of functions.
8087
+ * @returns {Function} Returns the new function.
8088
+ * @example
8089
+ *
8090
+ * function doubled(n) {
8091
+ * return n * 2;
8092
+ * }
8093
+ *
8094
+ * function square(n) {
8095
+ * return n * n;
8096
+ * }
8097
+ *
8098
+ * var modded = _.modArgs(function(x, y) {
8099
+ * return [x, y];
8100
+ * }, square, doubled);
8101
+ *
8102
+ * modded(1, 2);
8103
+ * // => [1, 4]
8104
+ *
8105
+ * modded(5, 10);
8106
+ * // => [25, 20]
8107
+ */
8108
+ var modArgs = restParam(function(func, transforms) {
8109
+ transforms = baseFlatten(transforms);
8110
+ if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
8111
+ throw new TypeError(FUNC_ERROR_TEXT);
8112
+ }
8113
+ var length = transforms.length;
8114
+ return restParam(function(args) {
8115
+ var index = nativeMin(args.length, length);
8116
+ while (index--) {
8117
+ args[index] = transforms[index](args[index]);
8118
+ }
8119
+ return func.apply(this, args);
8120
+ });
8121
+ });
8122
+
8082
8123
  /**
8083
8124
  * Creates a function that negates the result of the predicate `func`. The
8084
8125
  * `func` predicate is invoked with the `this` binding and arguments of the
@@ -8224,7 +8265,7 @@
8224
8265
  * // => [3, 6, 9]
8225
8266
  */
8226
8267
  var rearg = restParam(function(func, indexes) {
8227
- return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes));
8268
+ return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
8228
8269
  });
8229
8270
 
8230
8271
  /**
@@ -8370,10 +8411,7 @@
8370
8411
  leading = 'leading' in options ? !!options.leading : leading;
8371
8412
  trailing = 'trailing' in options ? !!options.trailing : trailing;
8372
8413
  }
8373
- debounceOptions.leading = leading;
8374
- debounceOptions.maxWait = +wait;
8375
- debounceOptions.trailing = trailing;
8376
- return debounce(func, wait, debounceOptions);
8414
+ return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });
8377
8415
  }
8378
8416
 
8379
8417
  /**
@@ -8399,7 +8437,7 @@
8399
8437
  */
8400
8438
  function wrap(value, wrapper) {
8401
8439
  wrapper = wrapper == null ? identity : wrapper;
8402
- return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []);
8440
+ return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
8403
8441
  }
8404
8442
 
8405
8443
  /*------------------------------------------------------------------------*/
@@ -8585,14 +8623,8 @@
8585
8623
  * // => false
8586
8624
  */
8587
8625
  function isArguments(value) {
8588
- return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag;
8589
- }
8590
- // Fallback for environments without a `toStringTag` for `arguments` objects.
8591
- if (!support.argsTag) {
8592
- isArguments = function(value) {
8593
- return isObjectLike(value) && isArrayLike(value) &&
8594
- hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
8595
- };
8626
+ return isObjectLike(value) && isArrayLike(value) &&
8627
+ hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
8596
8628
  }
8597
8629
 
8598
8630
  /**
@@ -8672,14 +8704,7 @@
8672
8704
  * // => false
8673
8705
  */
8674
8706
  function isElement(value) {
8675
- return !!value && value.nodeType === 1 && isObjectLike(value) &&
8676
- (lodash.support.nodeTag ? (objToString.call(value).indexOf('Element') > -1) : isHostObject(value));
8677
- }
8678
- // Fallback for environments without DOM support.
8679
- if (!support.dom) {
8680
- isElement = function(value) {
8681
- return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
8682
- };
8707
+ return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
8683
8708
  }
8684
8709
 
8685
8710
  /**
@@ -8794,7 +8819,7 @@
8794
8819
  /**
8795
8820
  * Checks if `value` is a finite primitive number.
8796
8821
  *
8797
- * **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite).
8822
+ * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
8798
8823
  *
8799
8824
  * @static
8800
8825
  * @memberOf _
@@ -8818,9 +8843,9 @@
8818
8843
  * _.isFinite(Infinity);
8819
8844
  * // => false
8820
8845
  */
8821
- var isFinite = nativeNumIsFinite || function(value) {
8846
+ function isFinite(value) {
8822
8847
  return typeof value == 'number' && nativeIsFinite(value);
8823
- };
8848
+ }
8824
8849
 
8825
8850
  /**
8826
8851
  * Checks if `value` is classified as a `Function` object.
@@ -8838,12 +8863,12 @@
8838
8863
  * _.isFunction(/abc/);
8839
8864
  * // => false
8840
8865
  */
8841
- var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {
8866
+ function isFunction(value) {
8842
8867
  // The use of `Object#toString` avoids issues with the `typeof` operator
8843
8868
  // in older versions of Chrome and Safari which return 'function' for regexes
8844
8869
  // and Safari 8 equivalents which return 'object' for typed array constructors.
8845
- return objToString.call(value) == funcTag;
8846
- };
8870
+ return isObject(value) && objToString.call(value) == funcTag;
8871
+ }
8847
8872
 
8848
8873
  /**
8849
8874
  * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
@@ -8967,7 +8992,7 @@
8967
8992
  if (value == null) {
8968
8993
  return false;
8969
8994
  }
8970
- if (objToString.call(value) == funcTag) {
8995
+ if (isFunction(value)) {
8971
8996
  return reIsNative.test(fnToString.call(value));
8972
8997
  }
8973
8998
  return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
@@ -9049,17 +9074,33 @@
9049
9074
  * _.isPlainObject(Object.create(null));
9050
9075
  * // => true
9051
9076
  */
9052
- var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
9053
- if (!(value && objToString.call(value) == objectTag) || (!lodash.support.argsTag && isArguments(value))) {
9077
+ function isPlainObject(value) {
9078
+ var Ctor;
9079
+
9080
+ // Exit early for non `Object` objects.
9081
+ if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) ||
9082
+ (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
9054
9083
  return false;
9055
9084
  }
9056
- var valueOf = getNative(value, 'valueOf'),
9057
- objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
9058
-
9059
- return objProto
9060
- ? (value == objProto || getPrototypeOf(value) == objProto)
9061
- : shimIsPlainObject(value);
9062
- };
9085
+ // IE < 9 iterates inherited properties before own properties. If the first
9086
+ // iterated property is an object's own property then there are no inherited
9087
+ // enumerable properties.
9088
+ var result;
9089
+ if (lodash.support.ownLast) {
9090
+ baseForIn(value, function(subValue, key, object) {
9091
+ result = hasOwnProperty.call(object, key);
9092
+ return false;
9093
+ });
9094
+ return result !== false;
9095
+ }
9096
+ // In most environments an object's own properties are iterated before
9097
+ // its inherited properties. If the last iterated property is an object's
9098
+ // own property then there are no inherited enumerable properties.
9099
+ baseForIn(value, function(subValue, key) {
9100
+ result = key;
9101
+ });
9102
+ return result === undefined || hasOwnProperty.call(value, result);
9103
+ }
9063
9104
 
9064
9105
  /**
9065
9106
  * Checks if `value` is classified as a `RegExp` object.
@@ -9246,6 +9287,56 @@
9246
9287
 
9247
9288
  /*------------------------------------------------------------------------*/
9248
9289
 
9290
+ /**
9291
+ * Recursively merges own enumerable properties of the source object(s), that
9292
+ * don't resolve to `undefined` into the destination object. Subsequent sources
9293
+ * overwrite property assignments of previous sources. If `customizer` is
9294
+ * provided it is invoked to produce the merged values of the destination and
9295
+ * source properties. If `customizer` returns `undefined` merging is handled
9296
+ * by the method instead. The `customizer` is bound to `thisArg` and invoked
9297
+ * with five arguments: (objectValue, sourceValue, key, object, source).
9298
+ *
9299
+ * @static
9300
+ * @memberOf _
9301
+ * @category Object
9302
+ * @param {Object} object The destination object.
9303
+ * @param {...Object} [sources] The source objects.
9304
+ * @param {Function} [customizer] The function to customize assigned values.
9305
+ * @param {*} [thisArg] The `this` binding of `customizer`.
9306
+ * @returns {Object} Returns `object`.
9307
+ * @example
9308
+ *
9309
+ * var users = {
9310
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
9311
+ * };
9312
+ *
9313
+ * var ages = {
9314
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
9315
+ * };
9316
+ *
9317
+ * _.merge(users, ages);
9318
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
9319
+ *
9320
+ * // using a customizer callback
9321
+ * var object = {
9322
+ * 'fruits': ['apple'],
9323
+ * 'vegetables': ['beet']
9324
+ * };
9325
+ *
9326
+ * var other = {
9327
+ * 'fruits': ['banana'],
9328
+ * 'vegetables': ['carrot']
9329
+ * };
9330
+ *
9331
+ * _.merge(object, other, function(a, b) {
9332
+ * if (_.isArray(a)) {
9333
+ * return a.concat(b);
9334
+ * }
9335
+ * });
9336
+ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
9337
+ */
9338
+ var merge = createAssigner(baseMerge);
9339
+
9249
9340
  /**
9250
9341
  * Assigns own enumerable properties of source object(s) to the destination
9251
9342
  * object. Subsequent sources overwrite property assignments of previous sources.
@@ -9254,7 +9345,7 @@
9254
9345
  * (objectValue, sourceValue, key, object, source).
9255
9346
  *
9256
9347
  * **Note:** This method mutates `object` and is based on
9257
- * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
9348
+ * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
9258
9349
  *
9259
9350
  * @static
9260
9351
  * @memberOf _
@@ -9321,7 +9412,7 @@
9321
9412
  function create(prototype, properties, guard) {
9322
9413
  var result = baseCreate(prototype);
9323
9414
  if (guard && isIterateeCall(prototype, properties, guard)) {
9324
- properties = null;
9415
+ properties = undefined;
9325
9416
  }
9326
9417
  return properties ? baseAssign(result, properties) : result;
9327
9418
  }
@@ -9344,14 +9435,27 @@
9344
9435
  * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
9345
9436
  * // => { 'user': 'barney', 'age': 36 }
9346
9437
  */
9347
- var defaults = restParam(function(args) {
9348
- var object = args[0];
9349
- if (object == null) {
9350
- return object;
9351
- }
9352
- args.push(assignDefaults);
9353
- return assign.apply(undefined, args);
9354
- });
9438
+ var defaults = createDefaults(assign, assignDefaults);
9439
+
9440
+ /**
9441
+ * This method is like `_.defaults` except that it recursively assigns
9442
+ * default properties.
9443
+ *
9444
+ * **Note:** This method mutates `object`.
9445
+ *
9446
+ * @static
9447
+ * @memberOf _
9448
+ * @category Object
9449
+ * @param {Object} object The destination object.
9450
+ * @param {...Object} [sources] The source objects.
9451
+ * @returns {Object} Returns `object`.
9452
+ * @example
9453
+ *
9454
+ * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
9455
+ * // => { 'user': { 'name': 'barney', 'age': 36 } }
9456
+ *
9457
+ */
9458
+ var defaultsDeep = createDefaults(merge, mergeDefaults);
9355
9459
 
9356
9460
  /**
9357
9461
  * This method is like `_.find` except that it returns the key of the first
@@ -9678,7 +9782,7 @@
9678
9782
  */
9679
9783
  function invert(object, multiValue, guard) {
9680
9784
  if (guard && isIterateeCall(object, multiValue, guard)) {
9681
- multiValue = null;
9785
+ multiValue = undefined;
9682
9786
  }
9683
9787
  var index = -1,
9684
9788
  props = keys(object),
@@ -9707,7 +9811,7 @@
9707
9811
  * Creates an array of the own enumerable property names of `object`.
9708
9812
  *
9709
9813
  * **Note:** Non-object values are coerced to objects. See the
9710
- * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys)
9814
+ * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
9711
9815
  * for more details.
9712
9816
  *
9713
9817
  * @static
@@ -9731,7 +9835,7 @@
9731
9835
  * // => ['0', '1']
9732
9836
  */
9733
9837
  var keys = !nativeKeys ? shimKeys : function(object) {
9734
- var Ctor = object == null ? null : object.constructor;
9838
+ var Ctor = object == null ? undefined : object.constructor;
9735
9839
  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
9736
9840
  (typeof object == 'function' ? lodash.support.enumPrototypes : isArrayLike(object))) {
9737
9841
  return shimKeys(object);
@@ -9883,56 +9987,6 @@
9883
9987
  */
9884
9988
  var mapValues = createObjectMapper();
9885
9989
 
9886
- /**
9887
- * Recursively merges own enumerable properties of the source object(s), that
9888
- * don't resolve to `undefined` into the destination object. Subsequent sources
9889
- * overwrite property assignments of previous sources. If `customizer` is
9890
- * provided it is invoked to produce the merged values of the destination and
9891
- * source properties. If `customizer` returns `undefined` merging is handled
9892
- * by the method instead. The `customizer` is bound to `thisArg` and invoked
9893
- * with five arguments: (objectValue, sourceValue, key, object, source).
9894
- *
9895
- * @static
9896
- * @memberOf _
9897
- * @category Object
9898
- * @param {Object} object The destination object.
9899
- * @param {...Object} [sources] The source objects.
9900
- * @param {Function} [customizer] The function to customize assigned values.
9901
- * @param {*} [thisArg] The `this` binding of `customizer`.
9902
- * @returns {Object} Returns `object`.
9903
- * @example
9904
- *
9905
- * var users = {
9906
- * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
9907
- * };
9908
- *
9909
- * var ages = {
9910
- * 'data': [{ 'age': 36 }, { 'age': 40 }]
9911
- * };
9912
- *
9913
- * _.merge(users, ages);
9914
- * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
9915
- *
9916
- * // using a customizer callback
9917
- * var object = {
9918
- * 'fruits': ['apple'],
9919
- * 'vegetables': ['beet']
9920
- * };
9921
- *
9922
- * var other = {
9923
- * 'fruits': ['banana'],
9924
- * 'vegetables': ['carrot']
9925
- * };
9926
- *
9927
- * _.merge(object, other, function(a, b) {
9928
- * if (_.isArray(a)) {
9929
- * return a.concat(b);
9930
- * }
9931
- * });
9932
- * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
9933
- */
9934
- var merge = createAssigner(baseMerge);
9935
-
9936
9990
  /**
9937
9991
  * The opposite of `_.pick`; this method creates an object composed of the
9938
9992
  * own and inherited enumerable properties of `object` that are not omitted.
@@ -10163,7 +10217,7 @@
10163
10217
  if (isArr) {
10164
10218
  accumulator = isArray(object) ? new Ctor : [];
10165
10219
  } else {
10166
- accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null);
10220
+ accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
10167
10221
  }
10168
10222
  } else {
10169
10223
  accumulator = {};
@@ -10266,7 +10320,7 @@
10266
10320
  */
10267
10321
  function inRange(value, start, end) {
10268
10322
  start = +start || 0;
10269
- if (typeof end === 'undefined') {
10323
+ if (end === undefined) {
10270
10324
  end = start;
10271
10325
  start = 0;
10272
10326
  } else {
@@ -10304,7 +10358,7 @@
10304
10358
  */
10305
10359
  function random(min, max, floating) {
10306
10360
  if (floating && isIterateeCall(min, max, floating)) {
10307
- max = floating = null;
10361
+ max = floating = undefined;
10308
10362
  }
10309
10363
  var noMin = min == null,
10310
10364
  noMax = max == null;
@@ -10491,8 +10545,8 @@
10491
10545
  function escapeRegExp(string) {
10492
10546
  string = baseToString(string);
10493
10547
  return (string && reHasRegExpChars.test(string))
10494
- ? string.replace(reRegExpChars, '\\$&')
10495
- : string;
10548
+ ? string.replace(reRegExpChars, escapeRegExpChar)
10549
+ : (string || '(?:)');
10496
10550
  }
10497
10551
 
10498
10552
  /**
@@ -10549,8 +10603,8 @@
10549
10603
  return string;
10550
10604
  }
10551
10605
  var mid = (length - strLength) / 2,
10552
- leftLength = floor(mid),
10553
- rightLength = ceil(mid);
10606
+ leftLength = nativeFloor(mid),
10607
+ rightLength = nativeCeil(mid);
10554
10608
 
10555
10609
  chars = createPadding('', rightLength, chars);
10556
10610
  return chars.slice(0, leftLength) + string + chars;
@@ -10628,25 +10682,16 @@
10628
10682
  * // => [6, 8, 10]
10629
10683
  */
10630
10684
  function parseInt(string, radix, guard) {
10631
- if (guard && isIterateeCall(string, radix, guard)) {
10685
+ // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
10686
+ // Chrome fails to trim leading <BOM> whitespace characters.
10687
+ // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
10688
+ if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
10632
10689
  radix = 0;
10690
+ } else if (radix) {
10691
+ radix = +radix;
10633
10692
  }
10634
- return nativeParseInt(string, radix);
10635
- }
10636
- // Fallback for environments with pre-ES5 implementations.
10637
- if (nativeParseInt(whitespace + '08') != 8) {
10638
- parseInt = function(string, radix, guard) {
10639
- // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
10640
- // Chrome fails to trim leading <BOM> whitespace characters.
10641
- // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
10642
- if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
10643
- radix = 0;
10644
- } else if (radix) {
10645
- radix = +radix;
10646
- }
10647
- string = trim(string);
10648
- return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
10649
- };
10693
+ string = trim(string);
10694
+ return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
10650
10695
  }
10651
10696
 
10652
10697
  /**
@@ -10682,7 +10727,7 @@
10682
10727
  if (n % 2) {
10683
10728
  result += string;
10684
10729
  }
10685
- n = floor(n / 2);
10730
+ n = nativeFloor(n / 2);
10686
10731
  string += string;
10687
10732
  } while (n);
10688
10733
 
@@ -10867,7 +10912,7 @@
10867
10912
  var settings = lodash.templateSettings;
10868
10913
 
10869
10914
  if (otherOptions && isIterateeCall(string, options, otherOptions)) {
10870
- options = otherOptions = null;
10915
+ options = otherOptions = undefined;
10871
10916
  }
10872
10917
  string = baseToString(string);
10873
10918
  options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
@@ -11103,7 +11148,7 @@
11103
11148
  */
11104
11149
  function trunc(string, options, guard) {
11105
11150
  if (guard && isIterateeCall(string, options, guard)) {
11106
- options = null;
11151
+ options = undefined;
11107
11152
  }
11108
11153
  var length = DEFAULT_TRUNC_LENGTH,
11109
11154
  omission = DEFAULT_TRUNC_OMISSION;
@@ -11198,7 +11243,7 @@
11198
11243
  */
11199
11244
  function words(string, pattern, guard) {
11200
11245
  if (guard && isIterateeCall(string, pattern, guard)) {
11201
- pattern = null;
11246
+ pattern = undefined;
11202
11247
  }
11203
11248
  string = baseToString(string);
11204
11249
  return string.match(pattern || reWords) || [];
@@ -11274,7 +11319,7 @@
11274
11319
  */
11275
11320
  function callback(func, thisArg, guard) {
11276
11321
  if (guard && isIterateeCall(func, thisArg, guard)) {
11277
- thisArg = null;
11322
+ thisArg = undefined;
11278
11323
  }
11279
11324
  return isObjectLike(func)
11280
11325
  ? matches(func)
@@ -11475,8 +11520,8 @@
11475
11520
  function mixin(object, source, options) {
11476
11521
  if (options == null) {
11477
11522
  var isObj = isObject(source),
11478
- props = isObj ? keys(source) : null,
11479
- methodNames = (props && props.length) ? baseFunctions(source, props) : null;
11523
+ props = isObj ? keys(source) : undefined,
11524
+ methodNames = (props && props.length) ? baseFunctions(source, props) : undefined;
11480
11525
 
11481
11526
  if (!(methodNames ? methodNames.length : isObj)) {
11482
11527
  methodNames = false;
@@ -11515,9 +11560,7 @@
11515
11560
  result.__chain__ = chainAll;
11516
11561
  return result;
11517
11562
  }
11518
- var args = [this.value()];
11519
- push.apply(args, arguments);
11520
- return func.apply(object, args);
11563
+ return func.apply(object, arrayPush([this.value()], arguments));
11521
11564
  };
11522
11565
  }(func));
11523
11566
  }
@@ -11538,7 +11581,7 @@
11538
11581
  * var lodash = _.noConflict();
11539
11582
  */
11540
11583
  function noConflict() {
11541
- context._ = oldDash;
11584
+ root._ = oldDash;
11542
11585
  return this;
11543
11586
  }
11544
11587
 
@@ -11647,7 +11690,7 @@
11647
11690
  */
11648
11691
  function range(start, end, step) {
11649
11692
  if (step && isIterateeCall(start, end, step)) {
11650
- end = step = null;
11693
+ end = step = undefined;
11651
11694
  }
11652
11695
  start = +start || 0;
11653
11696
  step = step == null ? 1 : (+step || 0);
@@ -11661,7 +11704,7 @@
11661
11704
  // Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
11662
11705
  // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
11663
11706
  var index = -1,
11664
- length = nativeMax(ceil((end - start) / (step || 1)), 0),
11707
+ length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
11665
11708
  result = Array(length);
11666
11709
 
11667
11710
  while (++index < length) {
@@ -11699,7 +11742,7 @@
11699
11742
  * // => also invokes `mage.castSpell(n)` three times
11700
11743
  */
11701
11744
  function times(n, iteratee, thisArg) {
11702
- n = floor(n);
11745
+ n = nativeFloor(n);
11703
11746
 
11704
11747
  // Exit early to avoid a JSC JIT bug in Safari 8
11705
11748
  // where `Array(0)` is treated as `Array(1)`.
@@ -11761,6 +11804,50 @@
11761
11804
  return (+augend || 0) + (+addend || 0);
11762
11805
  }
11763
11806
 
11807
+ /**
11808
+ * Calculates `n` rounded up to `precision`.
11809
+ *
11810
+ * @static
11811
+ * @memberOf _
11812
+ * @category Math
11813
+ * @param {number} n The number to round up.
11814
+ * @param {number} [precision=0] The precision to round up to.
11815
+ * @returns {number} Returns the rounded up number.
11816
+ * @example
11817
+ *
11818
+ * _.ceil(4.006);
11819
+ * // => 5
11820
+ *
11821
+ * _.ceil(6.004, 2);
11822
+ * // => 6.01
11823
+ *
11824
+ * _.ceil(6040, -2);
11825
+ * // => 6100
11826
+ */
11827
+ var ceil = createRound('ceil');
11828
+
11829
+ /**
11830
+ * Calculates `n` rounded down to `precision`.
11831
+ *
11832
+ * @static
11833
+ * @memberOf _
11834
+ * @category Math
11835
+ * @param {number} n The number to round down.
11836
+ * @param {number} [precision=0] The precision to round down to.
11837
+ * @returns {number} Returns the rounded down number.
11838
+ * @example
11839
+ *
11840
+ * _.floor(4.006);
11841
+ * // => 4
11842
+ *
11843
+ * _.floor(0.046, 2);
11844
+ * // => 0.04
11845
+ *
11846
+ * _.floor(4060, -2);
11847
+ * // => 4000
11848
+ */
11849
+ var floor = createRound('floor');
11850
+
11764
11851
  /**
11765
11852
  * Gets the maximum value of `collection`. If `collection` is empty or falsey
11766
11853
  * `-Infinity` is returned. If an iteratee function is provided it is invoked
@@ -11859,6 +11946,28 @@
11859
11946
  */
11860
11947
  var min = createExtremum(lt, POSITIVE_INFINITY);
11861
11948
 
11949
+ /**
11950
+ * Calculates `n` rounded to `precision`.
11951
+ *
11952
+ * @static
11953
+ * @memberOf _
11954
+ * @category Math
11955
+ * @param {number} n The number to round.
11956
+ * @param {number} [precision=0] The precision to round to.
11957
+ * @returns {number} Returns the rounded number.
11958
+ * @example
11959
+ *
11960
+ * _.round(4.006);
11961
+ * // => 4
11962
+ *
11963
+ * _.round(4.006, 2);
11964
+ * // => 4.01
11965
+ *
11966
+ * _.round(4060, -2);
11967
+ * // => 4100
11968
+ */
11969
+ var round = createRound('round');
11970
+
11862
11971
  /**
11863
11972
  * Gets the sum of the values in `collection`.
11864
11973
  *
@@ -11893,17 +12002,11 @@
11893
12002
  */
11894
12003
  function sum(collection, iteratee, thisArg) {
11895
12004
  if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
11896
- iteratee = null;
11897
- }
11898
- var callback = getCallback(),
11899
- noIteratee = iteratee == null;
11900
-
11901
- if (!(noIteratee && callback === baseCallback)) {
11902
- noIteratee = false;
11903
- iteratee = callback(iteratee, thisArg, 3);
12005
+ iteratee = undefined;
11904
12006
  }
11905
- return noIteratee
11906
- ? arraySum(isArray(collection) ? collection : toIterable(collection))
12007
+ iteratee = getCallback(iteratee, thisArg, 3);
12008
+ return iteratee.length == 1
12009
+ ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee)
11907
12010
  : baseSum(collection, iteratee);
11908
12011
  }
11909
12012
 
@@ -11950,6 +12053,7 @@
11950
12053
  lodash.curryRight = curryRight;
11951
12054
  lodash.debounce = debounce;
11952
12055
  lodash.defaults = defaults;
12056
+ lodash.defaultsDeep = defaultsDeep;
11953
12057
  lodash.defer = defer;
11954
12058
  lodash.delay = delay;
11955
12059
  lodash.difference = difference;
@@ -11988,6 +12092,7 @@
11988
12092
  lodash.method = method;
11989
12093
  lodash.methodOf = methodOf;
11990
12094
  lodash.mixin = mixin;
12095
+ lodash.modArgs = modArgs;
11991
12096
  lodash.negate = negate;
11992
12097
  lodash.omit = omit;
11993
12098
  lodash.once = once;
@@ -12063,6 +12168,7 @@
12063
12168
  lodash.attempt = attempt;
12064
12169
  lodash.camelCase = camelCase;
12065
12170
  lodash.capitalize = capitalize;
12171
+ lodash.ceil = ceil;
12066
12172
  lodash.clone = clone;
12067
12173
  lodash.cloneDeep = cloneDeep;
12068
12174
  lodash.deburr = deburr;
@@ -12078,6 +12184,7 @@
12078
12184
  lodash.findLastKey = findLastKey;
12079
12185
  lodash.findWhere = findWhere;
12080
12186
  lodash.first = first;
12187
+ lodash.floor = floor;
12081
12188
  lodash.get = get;
12082
12189
  lodash.gt = gt;
12083
12190
  lodash.gte = gte;
@@ -12126,6 +12233,7 @@
12126
12233
  lodash.reduceRight = reduceRight;
12127
12234
  lodash.repeat = repeat;
12128
12235
  lodash.result = result;
12236
+ lodash.round = round;
12129
12237
  lodash.runInContext = runInContext;
12130
12238
  lodash.size = size;
12131
12239
  lodash.snakeCase = snakeCase;
@@ -12196,48 +12304,20 @@
12196
12304
  lodash[methodName].placeholder = lodash;
12197
12305
  });
12198
12306
 
12199
- // Add `LazyWrapper` methods that accept an `iteratee` value.
12200
- arrayEach(['dropWhile', 'filter', 'map', 'takeWhile'], function(methodName, type) {
12201
- var isFilter = type != LAZY_MAP_FLAG,
12202
- isDropWhile = type == LAZY_DROP_WHILE_FLAG;
12203
-
12204
- LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
12205
- var filtered = this.__filtered__,
12206
- result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(),
12207
- iteratees = result.__iteratees__ || (result.__iteratees__ = []);
12208
-
12209
- iteratees.push({
12210
- 'done': false,
12211
- 'count': 0,
12212
- 'index': 0,
12213
- 'iteratee': getCallback(iteratee, thisArg, 1),
12214
- 'limit': -1,
12215
- 'type': type
12216
- });
12217
-
12218
- result.__filtered__ = filtered || isFilter;
12219
- return result;
12220
- };
12221
- });
12222
-
12223
12307
  // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
12224
12308
  arrayEach(['drop', 'take'], function(methodName, index) {
12225
- var whileName = methodName + 'While';
12226
-
12227
12309
  LazyWrapper.prototype[methodName] = function(n) {
12228
- var filtered = this.__filtered__,
12229
- result = (filtered && !index) ? this.dropWhile() : this.clone();
12310
+ var filtered = this.__filtered__;
12311
+ if (filtered && !index) {
12312
+ return new LazyWrapper(this);
12313
+ }
12314
+ n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0);
12230
12315
 
12231
- n = n == null ? 1 : nativeMax(floor(n) || 0, 0);
12316
+ var result = this.clone();
12232
12317
  if (filtered) {
12233
- if (index) {
12234
- result.__takeCount__ = nativeMin(result.__takeCount__, n);
12235
- } else {
12236
- last(result.__iteratees__).limit = n;
12237
- }
12318
+ result.__takeCount__ = nativeMin(result.__takeCount__, n);
12238
12319
  } else {
12239
- var views = result.__views__ || (result.__views__ = []);
12240
- views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
12320
+ result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
12241
12321
  }
12242
12322
  return result;
12243
12323
  };
@@ -12245,9 +12325,18 @@
12245
12325
  LazyWrapper.prototype[methodName + 'Right'] = function(n) {
12246
12326
  return this.reverse()[methodName](n).reverse();
12247
12327
  };
12328
+ });
12248
12329
 
12249
- LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) {
12250
- return this.reverse()[whileName](predicate, thisArg).reverse();
12330
+ // Add `LazyWrapper` methods that accept an `iteratee` value.
12331
+ arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
12332
+ var type = index + 1,
12333
+ isFilter = type != LAZY_MAP_FLAG;
12334
+
12335
+ LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
12336
+ var result = this.clone();
12337
+ result.__iteratees__.push({ 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type });
12338
+ result.__filtered__ = result.__filtered__ || isFilter;
12339
+ return result;
12251
12340
  };
12252
12341
  });
12253
12342
 
@@ -12265,7 +12354,7 @@
12265
12354
  var dropName = 'drop' + (index ? '' : 'Right');
12266
12355
 
12267
12356
  LazyWrapper.prototype[methodName] = function() {
12268
- return this[dropName](1);
12357
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12269
12358
  };
12270
12359
  });
12271
12360
 
@@ -12294,10 +12383,13 @@
12294
12383
  start = start == null ? 0 : (+start || 0);
12295
12384
 
12296
12385
  var result = this;
12386
+ if (result.__filtered__ && (start > 0 || end < 0)) {
12387
+ return new LazyWrapper(result);
12388
+ }
12297
12389
  if (start < 0) {
12298
- result = this.takeRight(-start);
12390
+ result = result.takeRight(-start);
12299
12391
  } else if (start) {
12300
- result = this.drop(start);
12392
+ result = result.drop(start);
12301
12393
  }
12302
12394
  if (end !== undefined) {
12303
12395
  end = (+end || 0);
@@ -12306,21 +12398,25 @@
12306
12398
  return result;
12307
12399
  };
12308
12400
 
12401
+ LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) {
12402
+ return this.reverse().takeWhile(predicate, thisArg).reverse();
12403
+ };
12404
+
12309
12405
  LazyWrapper.prototype.toArray = function() {
12310
- return this.drop(0);
12406
+ return this.take(POSITIVE_INFINITY);
12311
12407
  };
12312
12408
 
12313
12409
  // Add `LazyWrapper` methods to `lodash.prototype`.
12314
12410
  baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12315
- var lodashFunc = lodash[methodName];
12411
+ var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
12412
+ retUnwrapped = /^(?:first|last)$/.test(methodName),
12413
+ lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
12414
+
12316
12415
  if (!lodashFunc) {
12317
12416
  return;
12318
12417
  }
12319
- var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
12320
- retUnwrapped = /^(?:first|last)$/.test(methodName);
12321
-
12322
12418
  lodash.prototype[methodName] = function() {
12323
- var args = arguments,
12419
+ var args = retUnwrapped ? [1] : arguments,
12324
12420
  chainAll = this.__chain__,
12325
12421
  value = this.__wrapped__,
12326
12422
  isHybrid = !!this.__actions__.length,
@@ -12329,28 +12425,30 @@
12329
12425
  useLazy = isLazy || isArray(value);
12330
12426
 
12331
12427
  if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
12332
- // avoid lazy use if the iteratee has a "length" value other than `1`
12428
+ // Avoid lazy use if the iteratee has a "length" value other than `1`.
12333
12429
  isLazy = useLazy = false;
12334
12430
  }
12335
- var onlyLazy = isLazy && !isHybrid;
12336
- if (retUnwrapped && !chainAll) {
12337
- return onlyLazy
12338
- ? func.call(value)
12339
- : lodashFunc.call(lodash, this.value());
12340
- }
12341
12431
  var interceptor = function(value) {
12342
- var otherArgs = [value];
12343
- push.apply(otherArgs, args);
12344
- return lodashFunc.apply(lodash, otherArgs);
12432
+ return (retUnwrapped && chainAll)
12433
+ ? lodashFunc(value, 1)[0]
12434
+ : lodashFunc.apply(undefined, arrayPush([value], args));
12345
12435
  };
12346
- if (useLazy) {
12347
- var wrapper = onlyLazy ? value : new LazyWrapper(this),
12348
- result = func.apply(wrapper, args);
12349
12436
 
12350
- if (!retUnwrapped && (isHybrid || result.__actions__)) {
12351
- var actions = result.__actions__ || (result.__actions__ = []);
12352
- actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash });
12437
+ var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined },
12438
+ onlyLazy = isLazy && !isHybrid;
12439
+
12440
+ if (retUnwrapped && !chainAll) {
12441
+ if (onlyLazy) {
12442
+ value = value.clone();
12443
+ value.__actions__.push(action);
12444
+ return func.call(value);
12353
12445
  }
12446
+ return lodashFunc.call(undefined, this.value())[0];
12447
+ }
12448
+ if (!retUnwrapped && useLazy) {
12449
+ value = onlyLazy ? value : new LazyWrapper(this);
12450
+ var result = func.apply(value, args);
12451
+ result.__actions__.push(action);
12354
12452
  return new LodashWrapper(result, chainAll);
12355
12453
  }
12356
12454
  return this.thru(interceptor);
@@ -12358,7 +12456,7 @@
12358
12456
  });
12359
12457
 
12360
12458
  // Add `Array` and `String` methods to `lodash.prototype`.
12361
- arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
12459
+ arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
12362
12460
  var protoFunc = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
12363
12461
  chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
12364
12462
  fixObjects = !support.spliceObjects && /^(?:pop|shift|splice)$/.test(methodName),
@@ -12396,7 +12494,7 @@
12396
12494
  }
12397
12495
  });
12398
12496
 
12399
- realNames[createHybridWrapper(null, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': null }];
12497
+ realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }];
12400
12498
 
12401
12499
  // Add functions to the lazy wrapper.
12402
12500
  LazyWrapper.prototype.clone = lazyClone;
@@ -12406,6 +12504,7 @@
12406
12504
  // Add chaining functions to the `lodash` wrapper.
12407
12505
  lodash.prototype.chain = wrapperChain;
12408
12506
  lodash.prototype.commit = wrapperCommit;
12507
+ lodash.prototype.concat = wrapperConcat;
12409
12508
  lodash.prototype.plant = wrapperPlant;
12410
12509
  lodash.prototype.reverse = wrapperReverse;
12411
12510
  lodash.prototype.toString = wrapperToString;