lodash-rails 4.0.0 → 4.3.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: c383062767b34d64f945f014565aafc07f2344a0
4
- data.tar.gz: 0f65a16f6a49c36ecf4fba3a7da5cee034c7d03e
3
+ metadata.gz: 683705034482d70a5b12cbcb5ca04230e3bd6d30
4
+ data.tar.gz: 136a0a2258f0175b5ef3e55dccfb47e44e094a05
5
5
  SHA512:
6
- metadata.gz: aa7c1c37e5a3090d081008695471c2055de443660dc3c78ded82f2809f68ddf42876074829abbc7a8af5ed5bf56aa0c9a1dc62ac4e88a3bf17986b9b6347694a
7
- data.tar.gz: e07ce11e5abaa593e77620de344efa1e1f4253156f4f87046bc72318aa6a5f038ba7f47b04cae34655d8206b6a4b5452d4fabcac8dcec16df12723a21d46ba1e
6
+ metadata.gz: 5ec2e5c60c03cff8d00468fd236c8c48f395a35c89395ec57efe6e0508f1a2eb2beda7e3c26307894c58f46a8048a0069f58e202785330c50d1d26b0dc0c6770
7
+ data.tar.gz: 864719375289876c63b51db448c4f716d62492d81afb9474f346d79989f32937e1e96843b2dfb5a5c844c2047c39667b1f51e7ce0fd86c41503658316aef7d18
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 4.0.0:
21
+ lodash 4.3.0:
22
22
 
23
23
  * lodash.core.js
24
24
  * lodash.core.min.js
@@ -1,5 +1,5 @@
1
1
  module LoDash
2
2
  module Rails
3
- VERSION = "4.0.0"
3
+ VERSION = "4.3.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * lodash 4.0.0 (Custom Build) <https://lodash.com/>
3
+ * lodash 4.3.0 (Custom Build) <https://lodash.com/>
4
4
  * Build: `lodash core -o ./dist/lodash.core.js`
5
5
  * Copyright 2012-2016 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 = '4.0.0';
16
+ var VERSION = '4.3.0';
17
17
 
18
18
  /** Used to compose bitmasks for wrapper metadata. */
19
19
  var BIND_FLAG = 1,
@@ -159,7 +159,7 @@
159
159
  /**
160
160
  * The base implementation of methods like `_.find` and `_.findKey`, without
161
161
  * support for iteratee shorthands, which iterates over `collection` using
162
- * the provided `eachFunc`.
162
+ * `eachFunc`.
163
163
  *
164
164
  * @private
165
165
  * @param {Array|Object} collection The collection to search.
@@ -181,21 +181,20 @@
181
181
 
182
182
  /**
183
183
  * The base implementation of `_.reduce` and `_.reduceRight`, without support
184
- * for iteratee shorthands, which iterates over `collection` using the provided
185
- * `eachFunc`.
184
+ * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
186
185
  *
187
186
  * @private
188
187
  * @param {Array|Object} collection The collection to iterate over.
189
188
  * @param {Function} iteratee The function invoked per iteration.
190
189
  * @param {*} accumulator The initial value.
191
- * @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value.
190
+ * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
192
191
  * @param {Function} eachFunc The function to iterate over `collection`.
193
192
  * @returns {*} Returns the accumulated value.
194
193
  */
195
- function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
194
+ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
196
195
  eachFunc(collection, function(value, index, collection) {
197
- accumulator = initFromCollection
198
- ? (initFromCollection = false, value)
196
+ accumulator = initAccum
197
+ ? (initAccum = false, value)
199
198
  : iteratee(accumulator, value, index, collection);
200
199
  });
201
200
  return accumulator;
@@ -362,8 +361,8 @@
362
361
  var oldDash = root._;
363
362
 
364
363
  /** Built-in value references. */
365
- var _Symbol = root.Symbol,
366
- Reflect = root.Reflect,
364
+ var Reflect = root.Reflect,
365
+ Symbol = root.Symbol,
367
366
  Uint8Array = root.Uint8Array,
368
367
  enumerate = Reflect ? Reflect.enumerate : undefined,
369
368
  propertyIsEnumerable = objectProto.propertyIsEnumerable;
@@ -416,47 +415,48 @@
416
415
  * The chainable wrapper methods are:
417
416
  * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`,
418
417
  * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`,
419
- * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`,
418
+ * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`,
420
419
  * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
421
- * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
420
+ * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
422
421
  * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`,
423
- * `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
424
- * `forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`,
425
- * `intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`,
426
- * `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`,
427
- * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`,
428
- * `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`,
429
- * `over`, `overArgs`, `overEvery`, `overSome`, `partial`, `partialRight`,
430
- * `partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`,
431
- * `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`,
432
- * `reject`, `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`,
433
- * `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`,
434
- * `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`,
435
- * `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`,
436
- * `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`,
437
- * `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `without`,
438
- * `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, and `zipWith`
422
+ * `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`,
423
+ * `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invertBy`,
424
+ * `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`,
425
+ * `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`,
426
+ * `method`, `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`,
427
+ * `orderBy`, `over`, `overArgs`, `overEvery`, `overSome`, `partial`,
428
+ * `partialRight`, `partition`, `pick`, `pickBy`, `plant`, `property`,
429
+ * `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`,
430
+ * `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`,
431
+ * `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`,
432
+ * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
433
+ * `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`,
434
+ * `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`,
435
+ * `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`,
436
+ * `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`,
437
+ * `zipObjectDeep`, and `zipWith`
439
438
  *
440
439
  * The wrapper methods that are **not** chainable by default are:
441
440
  * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
442
441
  * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`,
443
442
  * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
444
- * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`,
445
- * `has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`,
446
- * `invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`,
447
- * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
448
- * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`,
449
- * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
450
- * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
451
- * `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`,
452
- * `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`,
453
- * `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`,
454
- * `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`,
455
- * `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`,
456
- * `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`,
457
- * `startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`,
458
- * `toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`,
459
- * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`,
443
+ * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`,
444
+ * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
445
+ * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
446
+ * `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
447
+ * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
448
+ * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`,
449
+ * `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`,
450
+ * `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`,
451
+ * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`,
452
+ * `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`,
453
+ * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
454
+ * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
455
+ * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
456
+ * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
457
+ * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`,
458
+ * `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`,
459
+ * `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`,
460
460
  * `upperCase`, `upperFirst`, `value`, and `words`
461
461
  *
462
462
  * @name _
@@ -472,11 +472,11 @@
472
472
  *
473
473
  * var wrapped = _([1, 2, 3]);
474
474
  *
475
- * // returns an unwrapped value
475
+ * // Returns an unwrapped value.
476
476
  * wrapped.reduce(_.add);
477
477
  * // => 6
478
478
  *
479
- * // returns a wrapped value
479
+ * // Returns a wrapped value.
480
480
  * var squares = wrapped.map(square);
481
481
  *
482
482
  * _.isArray(squares);
@@ -576,7 +576,7 @@
576
576
  * @private
577
577
  * @param {Function} func The function to delay.
578
578
  * @param {number} wait The number of milliseconds to delay invocation.
579
- * @param {Object} args The arguments provide to `func`.
579
+ * @param {Object} args The arguments to provide to `func`.
580
580
  * @returns {number} Returns the timer id.
581
581
  */
582
582
  function baseDelay(func, wait, args) {
@@ -692,7 +692,7 @@
692
692
 
693
693
  /**
694
694
  * The base implementation of `_.functions` which creates an array of
695
- * `object` function property names filtered from those provided.
695
+ * `object` function property names filtered from `props`.
696
696
  *
697
697
  * @private
698
698
  * @param {Object} object The object to inspect.
@@ -875,17 +875,18 @@
875
875
  * @returns {Function} Returns the new function.
876
876
  */
877
877
  function baseMatches(source) {
878
- var props = keys(source),
879
- length = props.length;
880
-
878
+ var props = keys(source);
881
879
  return function(object) {
880
+ var length = props.length;
882
881
  if (object == null) {
883
882
  return !length;
884
883
  }
885
884
  object = Object(object);
886
885
  while (length--) {
887
886
  var key = props[length];
888
- if (!(key in object && baseIsEqual(source[key], object[key], undefined, true))) {
887
+ if (!(key in object &&
888
+ baseIsEqual(source[key], object[key], undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG)
889
+ )) {
889
890
  return false;
890
891
  }
891
892
  }
@@ -1057,7 +1058,7 @@
1057
1058
  while (++index < length) {
1058
1059
  var source = sources[index];
1059
1060
  if (source) {
1060
- assigner(object, source, customizer);
1061
+ assigner(object, source, index, customizer);
1061
1062
  }
1062
1063
  }
1063
1064
  return object;
@@ -1289,7 +1290,6 @@
1289
1290
  */
1290
1291
  function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
1291
1292
  var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
1292
- isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
1293
1293
  objProps = keys(object),
1294
1294
  objLength = objProps.length,
1295
1295
  othProps = keys(other),
@@ -1301,8 +1301,7 @@
1301
1301
  var index = objLength;
1302
1302
  while (index--) {
1303
1303
  var key = objProps[index];
1304
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key)) ||
1305
- !(isUnordered || key == othProps[index])) {
1304
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1306
1305
  return false;
1307
1306
  }
1308
1307
  }
@@ -1362,9 +1361,11 @@
1362
1361
  */
1363
1362
  function indexKeys(object) {
1364
1363
  var length = object ? object.length : undefined;
1365
- return (isLength(length) && (isArray(object) || isString(object) || isArguments(object)))
1366
- ? baseTimes(length, String)
1367
- : null;
1364
+ if (isLength(length) &&
1365
+ (isArray(object) || isString(object) || isArguments(object))) {
1366
+ return baseTimes(length, String);
1367
+ }
1368
+ return null;
1368
1369
  }
1369
1370
 
1370
1371
  /**
@@ -1447,8 +1448,11 @@
1447
1448
  * // => [1]
1448
1449
  */
1449
1450
  var concat = rest(function(array, values) {
1451
+ if (!isArray(array)) {
1452
+ array = array == null ? [] : [Object(array)];
1453
+ }
1450
1454
  values = baseFlatten(values);
1451
- return arrayConcat(isArray(array) ? array : [Object(array)], values);
1455
+ return arrayConcat(array, values);
1452
1456
  });
1453
1457
 
1454
1458
  /**
@@ -1512,8 +1516,7 @@
1512
1516
  * Gets the index at which the first occurrence of `value` is found in `array`
1513
1517
  * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
1514
1518
  * for equality comparisons. If `fromIndex` is negative, it's used as the offset
1515
- * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
1516
- * performs a faster binary search.
1519
+ * from the end of `array`.
1517
1520
  *
1518
1521
  * @static
1519
1522
  * @memberOf _
@@ -1527,7 +1530,7 @@
1527
1530
  * _.indexOf([1, 2, 1, 2], 2);
1528
1531
  * // => 1
1529
1532
  *
1530
- * // using `fromIndex`
1533
+ * // Search from the `fromIndex`.
1531
1534
  * _.indexOf([1, 2, 1, 2], 2, 2);
1532
1535
  * // => 3
1533
1536
  */
@@ -1584,6 +1587,8 @@
1584
1587
  */
1585
1588
  function slice(array, start, end) {
1586
1589
  var length = array ? array.length : 0;
1590
+ start = start == null ? 0 : +start;
1591
+ end = end === undefined ? length : +end;
1587
1592
  return length ? baseSlice(array, start, end) : [];
1588
1593
  }
1589
1594
 
@@ -1623,10 +1628,9 @@
1623
1628
  }
1624
1629
 
1625
1630
  /**
1626
- * This method invokes `interceptor` and returns `value`. The interceptor is
1627
- * invoked with one argument; (value). The purpose of this method is to "tap into"
1628
- * a method chain in order to perform operations on intermediate results within
1629
- * the chain.
1631
+ * This method invokes `interceptor` and returns `value`. The interceptor
1632
+ * is invoked with one argument; (value). The purpose of this method is to
1633
+ * "tap into" a method chain in order to modify intermediate results.
1630
1634
  *
1631
1635
  * @static
1632
1636
  * @memberOf _
@@ -1638,6 +1642,7 @@
1638
1642
  *
1639
1643
  * _([1, 2, 3])
1640
1644
  * .tap(function(array) {
1645
+ * // Mutate input array.
1641
1646
  * array.pop();
1642
1647
  * })
1643
1648
  * .reverse()
@@ -1651,6 +1656,8 @@
1651
1656
 
1652
1657
  /**
1653
1658
  * This method is like `_.tap` except that it returns the result of `interceptor`.
1659
+ * The purpose of this method is to "pass thru" values replacing intermediate
1660
+ * results in a method chain.
1654
1661
  *
1655
1662
  * @static
1656
1663
  * @memberOf _
@@ -1687,11 +1694,11 @@
1687
1694
  * { 'user': 'fred', 'age': 40 }
1688
1695
  * ];
1689
1696
  *
1690
- * // without explicit chaining
1697
+ * // A sequence without explicit chaining.
1691
1698
  * _(users).head();
1692
1699
  * // => { 'user': 'barney', 'age': 36 }
1693
1700
  *
1694
- * // with explicit chaining
1701
+ * // A sequence with explicit chaining.
1695
1702
  * _(users)
1696
1703
  * .chain()
1697
1704
  * .head()
@@ -1708,7 +1715,7 @@
1708
1715
  *
1709
1716
  * @name value
1710
1717
  * @memberOf _
1711
- * @alias run, toJSON, valueOf
1718
+ * @alias toJSON, valueOf
1712
1719
  * @category Seq
1713
1720
  * @returns {*} Returns the resolved unwrapped value.
1714
1721
  * @example
@@ -1744,15 +1751,15 @@
1744
1751
  * { 'user': 'fred', 'active': false }
1745
1752
  * ];
1746
1753
  *
1747
- * // using the `_.matches` iteratee shorthand
1754
+ * // The `_.matches` iteratee shorthand.
1748
1755
  * _.every(users, { 'user': 'barney', 'active': false });
1749
1756
  * // => false
1750
1757
  *
1751
- * // using the `_.matchesProperty` iteratee shorthand
1758
+ * // The `_.matchesProperty` iteratee shorthand.
1752
1759
  * _.every(users, ['active', false]);
1753
1760
  * // => true
1754
1761
  *
1755
- * // using the `_.property` iteratee shorthand
1762
+ * // The `_.property` iteratee shorthand.
1756
1763
  * _.every(users, 'active');
1757
1764
  * // => false
1758
1765
  */
@@ -1782,15 +1789,15 @@
1782
1789
  * _.filter(users, function(o) { return !o.active; });
1783
1790
  * // => objects for ['fred']
1784
1791
  *
1785
- * // using the `_.matches` iteratee shorthand
1792
+ * // The `_.matches` iteratee shorthand.
1786
1793
  * _.filter(users, { 'age': 36, 'active': true });
1787
1794
  * // => objects for ['barney']
1788
1795
  *
1789
- * // using the `_.matchesProperty` iteratee shorthand
1796
+ * // The `_.matchesProperty` iteratee shorthand.
1790
1797
  * _.filter(users, ['active', false]);
1791
1798
  * // => objects for ['fred']
1792
1799
  *
1793
- * // using the `_.property` iteratee shorthand
1800
+ * // The `_.property` iteratee shorthand.
1794
1801
  * _.filter(users, 'active');
1795
1802
  * // => objects for ['barney']
1796
1803
  */
@@ -1820,15 +1827,15 @@
1820
1827
  * _.find(users, function(o) { return o.age < 40; });
1821
1828
  * // => object for 'barney'
1822
1829
  *
1823
- * // using the `_.matches` iteratee shorthand
1830
+ * // The `_.matches` iteratee shorthand.
1824
1831
  * _.find(users, { 'age': 1, 'active': true });
1825
1832
  * // => object for 'pebbles'
1826
1833
  *
1827
- * // using the `_.matchesProperty` iteratee shorthand
1834
+ * // The `_.matchesProperty` iteratee shorthand.
1828
1835
  * _.find(users, ['active', false]);
1829
1836
  * // => object for 'fred'
1830
1837
  *
1831
- * // using the `_.property` iteratee shorthand
1838
+ * // The `_.property` iteratee shorthand.
1832
1839
  * _.find(users, 'active');
1833
1840
  * // => object for 'barney'
1834
1841
  */
@@ -1868,36 +1875,6 @@
1868
1875
  return baseEach(collection, toFunction(iteratee));
1869
1876
  }
1870
1877
 
1871
- /**
1872
- * Invokes the method at `path` of each element in `collection`, returning
1873
- * an array of the results of each invoked method. Any additional arguments
1874
- * are provided to each invoked method. If `methodName` is a function it's
1875
- * invoked for, and `this` bound to, each element in `collection`.
1876
- *
1877
- * @static
1878
- * @memberOf _
1879
- * @category Collection
1880
- * @param {Array|Object} collection The collection to iterate over.
1881
- * @param {Array|Function|string} path The path of the method to invoke or
1882
- * the function invoked per iteration.
1883
- * @param {...*} [args] The arguments to invoke each method with.
1884
- * @returns {Array} Returns the array of results.
1885
- * @example
1886
- *
1887
- * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
1888
- * // => [[1, 5, 7], [1, 2, 3]]
1889
- *
1890
- * _.invokeMap([123, 456], String.prototype.split, '');
1891
- * // => [['1', '2', '3'], ['4', '5', '6']]
1892
- */
1893
- var invokeMap = rest(function(collection, path, args) {
1894
- var isFunc = typeof path == 'function';
1895
- return baseMap(collection, function(value) {
1896
- var func = isFunc ? path : value[path];
1897
- return func == null ? func : func.apply(value, args);
1898
- });
1899
- });
1900
-
1901
1878
  /**
1902
1879
  * Creates an array of values by running each element in `collection` through
1903
1880
  * `iteratee`. The iteratee is invoked with three arguments:
@@ -1924,18 +1901,18 @@
1924
1901
  * return n * n;
1925
1902
  * }
1926
1903
  *
1927
- * _.map([1, 2], square);
1928
- * // => [3, 6]
1904
+ * _.map([4, 8], square);
1905
+ * // => [16, 64]
1929
1906
  *
1930
- * _.map({ 'a': 1, 'b': 2 }, square);
1931
- * // => [3, 6] (iteration order is not guaranteed)
1907
+ * _.map({ 'a': 4, 'b': 8 }, square);
1908
+ * // => [16, 64] (iteration order is not guaranteed)
1932
1909
  *
1933
1910
  * var users = [
1934
1911
  * { 'user': 'barney' },
1935
1912
  * { 'user': 'fred' }
1936
1913
  * ];
1937
1914
  *
1938
- * // using the `_.property` iteratee shorthand
1915
+ * // The `_.property` iteratee shorthand.
1939
1916
  * _.map(users, 'user');
1940
1917
  * // => ['barney', 'fred']
1941
1918
  */
@@ -1947,7 +1924,7 @@
1947
1924
  * Reduces `collection` to a value which is the accumulated result of running
1948
1925
  * each element in `collection` through `iteratee`, where each successive
1949
1926
  * invocation is supplied the return value of the previous. If `accumulator`
1950
- * is not provided the first element of `collection` is used as the initial
1927
+ * is not given the first element of `collection` is used as the initial
1951
1928
  * value. The iteratee is invoked with four arguments:
1952
1929
  * (accumulator, value, index|key, collection).
1953
1930
  *
@@ -1969,7 +1946,7 @@
1969
1946
  *
1970
1947
  * _.reduce([1, 2], function(sum, n) {
1971
1948
  * return sum + n;
1972
- * });
1949
+ * }, 0);
1973
1950
  * // => 3
1974
1951
  *
1975
1952
  * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
@@ -2032,15 +2009,15 @@
2032
2009
  * { 'user': 'fred', 'active': false }
2033
2010
  * ];
2034
2011
  *
2035
- * // using the `_.matches` iteratee shorthand
2012
+ * // The `_.matches` iteratee shorthand.
2036
2013
  * _.some(users, { 'user': 'barney', 'active': false });
2037
2014
  * // => false
2038
2015
  *
2039
- * // using the `_.matchesProperty` iteratee shorthand
2016
+ * // The `_.matchesProperty` iteratee shorthand.
2040
2017
  * _.some(users, ['active', false]);
2041
2018
  * // => true
2042
2019
  *
2043
- * // using the `_.property` iteratee shorthand
2020
+ * // The `_.property` iteratee shorthand.
2044
2021
  * _.some(users, 'active');
2045
2022
  * // => true
2046
2023
  */
@@ -2095,26 +2072,6 @@
2095
2072
 
2096
2073
  /*------------------------------------------------------------------------*/
2097
2074
 
2098
- /**
2099
- * Gets the timestamp of the number of milliseconds that have elapsed since
2100
- * the Unix epoch (1 January 1970 00:00:00 UTC).
2101
- *
2102
- * @static
2103
- * @memberOf _
2104
- * @type Function
2105
- * @category Date
2106
- * @returns {number} Returns the timestamp.
2107
- * @example
2108
- *
2109
- * _.defer(function(stamp) {
2110
- * console.log(_.now() - stamp);
2111
- * }, _.now());
2112
- * // => logs the number of milliseconds it took for the deferred function to be invoked
2113
- */
2114
- var now = Date.now;
2115
-
2116
- /*------------------------------------------------------------------------*/
2117
-
2118
2075
  /**
2119
2076
  * Creates a function that invokes `func`, with the `this` binding and arguments
2120
2077
  * of the created function, while it's called less than `n` times. Subsequent
@@ -2178,7 +2135,7 @@
2178
2135
  * bound('!');
2179
2136
  * // => 'hi fred!'
2180
2137
  *
2181
- * // using placeholders
2138
+ * // Bound with placeholders.
2182
2139
  * var bound = _.bind(greet, object, _, '!');
2183
2140
  * bound('hi');
2184
2141
  * // => 'hi fred!'
@@ -2202,7 +2159,7 @@
2202
2159
  * _.defer(function(text) {
2203
2160
  * console.log(text);
2204
2161
  * }, 'deferred');
2205
- * // logs 'deferred' after one or more milliseconds
2162
+ * // => logs 'deferred' after one or more milliseconds
2206
2163
  */
2207
2164
  var defer = rest(function(func, args) {
2208
2165
  return baseDelay(func, 1, args);
@@ -2590,9 +2547,16 @@
2590
2547
  * // => false
2591
2548
  */
2592
2549
  function isEmpty(value) {
2593
- return (!isObjectLike(value) || isFunction(value.splice))
2594
- ? !size(value)
2595
- : !keys(value).length;
2550
+ if (isArrayLike(value) &&
2551
+ (isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) {
2552
+ return !value.length;
2553
+ }
2554
+ for (var key in value) {
2555
+ if (hasOwnProperty.call(value, key)) {
2556
+ return false;
2557
+ }
2558
+ }
2559
+ return true;
2596
2560
  }
2597
2561
 
2598
2562
  /**
@@ -2730,8 +2694,6 @@
2730
2694
  * // => false
2731
2695
  */
2732
2696
  function isObject(value) {
2733
- // Avoid a V8 JIT bug in Chrome 19-20.
2734
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
2735
2697
  var type = typeof value;
2736
2698
  return !!value && (type == 'object' || type == 'function');
2737
2699
  }
@@ -3131,13 +3093,13 @@
3131
3093
  * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
3132
3094
  * // => { 'a': 1, 'b': 2 }
3133
3095
  */
3134
- var assignInWith = createAssigner(function(object, source, customizer) {
3096
+ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
3135
3097
  copyObjectWith(source, keysIn(source), object, customizer);
3136
3098
  });
3137
3099
 
3138
3100
  /**
3139
3101
  * Creates an object that inherits from the `prototype` object. If a `properties`
3140
- * object is provided its own enumerable properties are assigned to the created object.
3102
+ * object is given its own enumerable properties are assigned to the created object.
3141
3103
  *
3142
3104
  * @static
3143
3105
  * @memberOf _
@@ -3445,7 +3407,7 @@
3445
3407
  /*------------------------------------------------------------------------*/
3446
3408
 
3447
3409
  /**
3448
- * This method returns the first argument provided to it.
3410
+ * This method returns the first argument given to it.
3449
3411
  *
3450
3412
  * @static
3451
3413
  * @memberOf _
@@ -3481,7 +3443,7 @@
3481
3443
  * { 'user': 'fred', 'age': 40 }
3482
3444
  * ];
3483
3445
  *
3484
- * // create custom iteratee shorthands
3446
+ * // Create custom iteratee shorthands.
3485
3447
  * _.iteratee = _.wrap(_.iteratee, function(callback, func) {
3486
3448
  * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
3487
3449
  * return !p ? callback(func) : function(object) {
@@ -3494,6 +3456,32 @@
3494
3456
  */
3495
3457
  var iteratee = baseIteratee;
3496
3458
 
3459
+ /**
3460
+ * Creates a function that performs a deep partial comparison between a given
3461
+ * object and `source`, returning `true` if the given object has equivalent
3462
+ * property values, else `false`.
3463
+ *
3464
+ * **Note:** This method supports comparing the same values as `_.isEqual`.
3465
+ *
3466
+ * @static
3467
+ * @memberOf _
3468
+ * @category Util
3469
+ * @param {Object} source The object of property values to match.
3470
+ * @returns {Function} Returns the new function.
3471
+ * @example
3472
+ *
3473
+ * var users = [
3474
+ * { 'user': 'barney', 'age': 36, 'active': true },
3475
+ * { 'user': 'fred', 'age': 40, 'active': false }
3476
+ * ];
3477
+ *
3478
+ * _.filter(users, _.matches({ 'age': 40, 'active': false }));
3479
+ * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
3480
+ */
3481
+ function matches(source) {
3482
+ return baseMatches(assign({}, source));
3483
+ }
3484
+
3497
3485
  /**
3498
3486
  * Adds all own enumerable function properties of a source object to the
3499
3487
  * destination object. If `object` is a function then methods are added to
@@ -3579,7 +3567,9 @@
3579
3567
  * var lodash = _.noConflict();
3580
3568
  */
3581
3569
  function noConflict() {
3582
- root._ = oldDash;
3570
+ if (root._ === this) {
3571
+ root._ = oldDash;
3572
+ }
3583
3573
  return this;
3584
3574
  }
3585
3575
 
@@ -3602,7 +3592,7 @@
3602
3592
  }
3603
3593
 
3604
3594
  /**
3605
- * Generates a unique ID. If `prefix` is provided the ID is appended to it.
3595
+ * Generates a unique ID. If `prefix` is given the ID is appended to it.
3606
3596
  *
3607
3597
  * @static
3608
3598
  * @memberOf _
@@ -3689,10 +3679,10 @@
3689
3679
  lodash.filter = filter;
3690
3680
  lodash.flatten = flatten;
3691
3681
  lodash.flattenDeep = flattenDeep;
3692
- lodash.invokeMap = invokeMap;
3693
3682
  lodash.iteratee = iteratee;
3694
3683
  lodash.keys = keys;
3695
3684
  lodash.map = map;
3685
+ lodash.matches = matches;
3696
3686
  lodash.mixin = mixin;
3697
3687
  lodash.negate = negate;
3698
3688
  lodash.once = once;
@@ -3705,7 +3695,6 @@
3705
3695
  lodash.values = values;
3706
3696
 
3707
3697
  // Add aliases.
3708
- lodash.each = forEach;
3709
3698
  lodash.extend = assignIn;
3710
3699
 
3711
3700
  // Add functions to `lodash.prototype`.
@@ -3743,7 +3732,6 @@
3743
3732
  lodash.min = min;
3744
3733
  lodash.noConflict = noConflict;
3745
3734
  lodash.noop = noop;
3746
- lodash.now = now;
3747
3735
  lodash.reduce = reduce;
3748
3736
  lodash.result = result;
3749
3737
  lodash.size = size;
@@ -3751,6 +3739,7 @@
3751
3739
  lodash.uniqueId = uniqueId;
3752
3740
 
3753
3741
  // Add aliases.
3742
+ lodash.each = forEach;
3754
3743
  lodash.first = head;
3755
3744
 
3756
3745
  mixin(lodash, (function() {