8000 Bump to v3.3.0. · lodash/lodash@f8e4370 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8e4370

Browse files
committed
Bump to v3.3.0.
1 parent 3ccb5e7 commit f8e4370

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+826
-401
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v3.2.0
1+
# lodash v3.3.0
22

33
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
44

array/difference.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define(['../internal/baseDifference', '../internal/baseFlatten', '../lang/isArgu
1717
* @returns {Array} Returns the new array of filtered values.
1818
* @example
1919
*
20-
* _.difference([1, 2, 3], [5, 2, 10]);
20+
* _.difference([1, 2, 3], [4, 2]);
2121
* // => [1, 3]
2222
*/
2323
function difference() {

array/dropRightWhile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ define(['../internal/baseCallback', '../internal/baseSlice'], function(baseCallb
2626
* @returns {Array} Returns the slice of `array`.
2727
* @example
2828
*
29-
* _.dropRightWhile([1, 2, 3], function(n) { return n > 1; });
29+
* _.dropRightWhile([1, 2, 3], function(n) {
30+
* return n > 1;
31+
* });
3032
* // => [1]
3133
*
3234
* var users = [

array/dropWhile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ define(['../internal/baseCallback', '../internal/baseSlice'], function(baseCallb
2626
* @returns {Array} Returns the slice of `array`.
2727
* @example
2828
*
29-
* _.dropWhile([1, 2, 3], function(n) { return n < 3; });
29+
* _.dropWhile([1, 2, 3], function(n) {
30+
* return n < 3;
31+
* });
3032
* // => [3]
3133
*
3234
* var users = [

array/findIndex.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ define(['../internal/baseCallback'], function(baseCallback) {
3131
* { 'user': 'pebbles', 'active': true }
3232
* ];
3333
*
34-
* _.findIndex(users, function(chr) { return chr.user == 'barney'; });
34+
* _.findIndex(users, function(chr) {
35+
* return chr.user == 'barney';
36+
* });
3537
* // => 0
3638
*
3739
* // using the `_.matches` callback shorthand

array/findLastIndex.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line chang 2851 e
@@ -31,7 +31,9 @@ define(['../internal/baseCallback'], function(baseCallback) {
3131
* { 'user': 'pebbles', 'active': false }
3232
* ];
3333
*
34-
* _.findLastIndex(users, function(chr) { return chr.user == 'pebbles'; });
34+
* _.findLastIndex(users, function(chr) {
35+
* return chr.user == 'pebbles';
36+
* });
3537
* // => 2
3638
*
3739
* // using the `_.matches` callback shorthand

array/flatten.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ define(['../internal/baseFlatten', '../internal/isIterateeCall'], function(baseF
1313
* @returns {Array} Returns the new flattened array.
1414
* @example
1515
*
16-
* _.flatten([1, [2], [3, [[4]]]]);
17-
* // => [1, 2, 3, [[4]]];
16+
* _.flatten([1, [2, 3, [4]]]);
17+
* // => [1, 2, 3, [4]];
1818
*
1919
* // using `isDeep`
20-
* _.flatten([1, [2], [3, [[4]]]], true);
20+
* _.flatten([1, [2, 3, [4]]], true);
2121
* // => [1, 2, 3, 4];
2222
*/
2323
function flatten(array, isDeep, guard) {

array/flattenDeep.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define(['../internal/baseFlatten'], function(baseFlatten) {
1010
* @returns {Array} Returns the new flattened array.
1111
* @example
1212
*
13-
* _.flattenDeep([1, [2], [3, [[4]]]]);
13+
* _.flattenDeep([1, [2, 3, [4]]]);
1414
* // => [1, 2, 3, 4];
1515
*/
1616
function flattenDeep(array) {

array/indexOf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ define(['../internal/baseIndexOf', '../internal/binaryIndex'], function(baseInde
2424
* @returns {number} Returns the index of the matched value, else `-1`.
2525
* @example
2626
*
27-
* _.indexOf([1, 2, 3, 1, 2, 3], 2);
28-
* // => 1
27+
* _.indexOf([1, 2, 1, 2], 2);
28+
* // => 2
2929
*
3030
* // using `fromIndex`
31-
* _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
32-
* // => 4
31+
* _.indexOf([1, 2, 1, 2], 2, 2);
32+
* // => 3
3333
*
3434
* // performing a binary search
35-
* _.indexOf([4, 4, 5, 5, 6, 6], 5, true);
35+
* _.indexOf([1, 1, 2, 2], 2, true);
3636
* // => 2
3737
*/
3838
function indexOf(array, value, fromIndex) {

array/intersection.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/crea
1515
* @param {...Array} [arrays] The arrays to inspect.
1616
* @returns {Array} Returns the new array of shared values.
1717
* @example
18-
*
19-
* _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
20-
* // => [1, 2]
18+
* _.intersection([1, 2], [4, 2], [2, 1]);
19+
* // => [2]
2120
*/
2221
function intersection() {
2322
var args = [],

array/lastIndexOf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ define(['../internal/binaryIndex', '../internal/indexOfNaN'], function(binaryInd
1818
* @returns {number} Returns the index of the matched value, else `-1`.
1919
* @example
2020
*
21-
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
22-
* // => 4
21+
* _.lastIndexOf([1, 2, 1, 2], 2);
22+
* // => 3
2323
*
2424
* // using `fromIndex`
25-
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
25+
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
2626
* // => 1
2727
*
2828
* // performing a binary search
29-
* _.lastIndexOf([4, 4, 5, 5, 6, 6], 5, true);
29+
* _.lastIndexOf([1, 1, 2, 2], 2, true);
3030
* // => 3
3131
*/
3232
function lastIndexOf(array, value, fromIndex) {

array/pull.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define(['../internal/baseIndexOf'], function(baseIndexOf) {
2525
* @example
2626
*
2727
* var array = [1, 2, 3, 1, 2, 3];
28+
*
2829
* _.pull(array, 2, 3);
2930
* console.log(array);
3031
* // => [1, 1]

array/pullAt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define(['../internal/baseFlatten', '../internal/basePullAt'], function(baseFlatt
1717
* @example
1818
*
1919
* var array = [5, 10, 15, 20];
20-
* var evens = _.pullAt(array, [1, 3]);
20+
* var evens = _.pullAt(array, 1, 3);
2121
*
2222
* console.log(array);
2323
* // => [5, 15]

array/remove.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ define(['../internal/baseCallback'], function(baseCallback) {
3535
* @example
3636
*
3737
* var array = [1, 2, 3, 4];
38-
* var evens = _.remove(array, function(n) { return n % 2 == 0; });
38+
* var evens = _.remove(array, function(n) {
39+
* return n % 2 == 0;
40+
* });
3941
*
4042
* console.log(array);
4143
* // => [1, 3]

array/sortedIndex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ define(['../internal/baseCallback', '../internal/binaryIndex', '../internal/bina
3333
* _.sortedIndex([30, 50], 40);
3434
* // => 1
3535
*
36-
* _.sortedIndex([4, 4, 5, 5, 6, 6], 5);
36+
* _.sortedIndex([4, 4, 5, 5], 5);
3737
* // => 2
3838
*
3939
* var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };

array/sortedLastIndex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define(['../internal/baseCallback', '../internal/binaryIndex', '../internal/bina
1717
* into `array`.
1818
* @example
1919
*
20-
* _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5);
20+
* _.sortedLastIndex([4, 4, 5, 5], 5);
2121
* // => 4
2222
*/
2323
function sortedLastIndex(array, value, iteratee, thisArg) {

array/takeRightWhile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ define(['../internal/baseCallback', '../internal/baseSlice'], function(baseCallb
2626
* @returns {Array} Returns the slice of `array`.
2727
* @example
2828
*
29-
* _.takeRightWhile([1, 2, 3], function(n) { return n > 1; });
29+
* _.takeRightWhile([1, 2, 3], function(n) {
30+
* return n > 1;
31+
* });
3032
* // => [2, 3]
3133
*
3234
* var users = [

array/takeWhile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ define(['../internal/baseCallback', '../internal/baseSlice'], function(baseCallb
2626
* @returns {Array} Returns the slice of `array`.
2727
* @example
2828
*
29-
* _.takeWhile([1, 2, 3], function(n) { return n < 3; });
29+
* _.takeWhile([1, 2, 3], function(n) {
30+
* return n < 3;
31+
* });
3032
* // => [1, 2]
3133
*
3234
* var users = [

array/union.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ define(['../internal/baseFlatten', '../internal/baseUniq'], function(baseFlatten
1616
* @returns {Array} Returns the new array of combined values.
1717
* @example
1818
*
19-
* _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
20-
* // => [1, 2, 3, 5, 4]
19+
* _.union([1, 2], [4, 2], [2, 1]);
20+
* // => [1, 2, 4]
2121
*/
2222
function union() {
2323
return baseUniq(baseFlatten(arguments, false, true));

array/uniq.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ define(['../internal/baseCallback', '../internal/baseUniq', '../internal/isItera
4343
* // => [1, 2]
4444
*
4545
* // using an iteratee function
46-
* _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math);
46+
* _.uniq([1, 2.5, 1.5, 2], function(n) {
47+
* return this.floor(n);
48+
* }, Math);
4749
* // => [1, 2.5]
4850
*
4951
* // using the `_.property` callback shorthand
@@ -55,8 +57,7 @@ define(['../internal/baseCallback', '../internal/baseUniq', '../internal/isItera
5557
if (!length) {
5658
return [];
5759
}
58-
// Juggle arguments.
59-
if (typeof isSorted != 'boolean' && isSorted != null) {
60+
if (isSorted != null && typeof isSorted != 'boolean') {
6061
thisArg = iteratee;
6162
iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted;
6263
isSorted = false;

array/without.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ define(['../internal/baseDifference', '../internal/baseSlice'], function(baseDif
1717
* @returns {Array} Returns the new array of filtered values.
1818
* @example
1919
*
20-
* _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
21-
* // => [2, 3, 4]
20+
* _.without([1, 2, 1, 3], 1, 2);
21+
* // => [3]
2222
*/
2323
function without(array) {
2424
return baseDifference(array, baseSlice(arguments, 1));

array/xor.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ define(['../internal/baseDifference', '../internal/baseUniq', '../lang/isArgumen
1212
* @returns {Array} Returns the new array of values.
1313
* @example
1414
*
15-
* _.xor([1, 2, 3], [5, 2, 1, 4]);
16-
* // => [3, 5, 4]
17-
*
18-
* _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
19-
* // => [1, 4, 5]
15+
* _.xor([1, 2], [4, 2]);
16+
* // => [1, 4]
2017
*/
2118
function xor() {
2219
var index = -1,

chain/chain.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ define(['./lodash'], function(lodash) {
1919
*
2020
* var youngest = _.chain(users)
2121
* .sortBy('age')
22-
* .map(function(chr) { return chr.user + ' is ' + chr.age; })
22+
* .map(function(chr) {
23+
* return chr.user + ' is ' + chr.age;
24+
* })
2325
* .first()
2426
* .value();
2527
* // => 'pebbles is 1'

chain/lodash.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../lang/isArray', '../internal/isObjectLike', '../internal/wrapperClone'], function(LazyWrapper, LodashWrapper, isArray, isObjectLike, wrapperClone) {
1+
define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../internal/baseLodash', '../lang/isArray', '../internal/isObjectLike', '../internal/wrapperClone'], function(LazyWrapper, LodashWrapper, baseLodash, isArray, isObjectLike, wrapperClone) {
22

33
/** Used for native method references. */
44
var objectProto = Object.prototype;
@@ -78,11 +78,15 @@ define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../lang/isArray
7878
* var wrapped = _([1, 2, 3]);
7979
*
8080
* // returns an unwrapped value
81-
* wrapped.reduce(function(sum, n) { return sum + n; });
81+
* wrapped.reduce(function(sum, n) {
82+
* return sum + n;
83+
* });
8284
* // => 6
8385
*
8486
* // returns a wrapped value
85-
* var squares = wrapped.map(function(n) { return n * n; });
87+
* var squares = wrapped.map(function(n) {
88+
* return n * n;
89+
* });
8690
*
8791
* _.isArray(squares);
8892
* // => false
@@ -102,5 +106,8 @@ define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../lang/isArray
102106
return new LodashWrapper(value);
103107
}
104108

109+
// Ensure wrappers are instances of `baseLodash`.
110+
lodash.prototype = baseLodash.prototype;
111+
105112
return lodash;
106113
});

chain/tap.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ define([], function() {
1616
* @example
1717
*
1818
* _([1, 2, 3])
19-
* .tap(function(array) { array.pop(); })
19+
* .tap(function(array) {
20+
* array.pop();
21+
* })
2022
* .reverse()
2123
* .value();
2224
* // => [2, 1]

chain/thru.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ define([], function() {
1414
*
1515
* _([1, 2, 3])
1616
* .last()
17-
* .thru(function(value) { return [value]; })
17+
* .thru(function(value) {
18+
* return [value];
19+
* })
1820
* .value();
1921
* // => [3]
2022
*/

chain/wrapperPlant.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(['../internal/LodashWrapper', '../internal/wrapperClone'], function(LodashWrapper, wrapperClone) {
1+
define(['../internal/baseLodash', '../internal/wrapperClone'], function(baseLodash, wrapperClone) {
22

33
/**
44
* Creates a clone of the chained sequence planting `value` as the wrapped value.
@@ -27,7 +27,7 @@ define(['../internal/LodashWrapper', '../internal/wrapperClone'], function(Lodas
2727
var result,
2828
parent = this;
2929

30-
while (parent instanceof LodashWrapper) {
30+
while (parent instanceof baseLodash) {
3131
var clone = wrapperClone(parent);
3232
if (result) {
3333
previous.__wrapped__ = clone;

collection/at.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ define(['../internal/baseAt', '../internal/baseFlatten', '../internal/isLength',
1414
* @returns {Array} Returns the new array of picked elements.
1515
* @example
1616
*
17-
* _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
18-
* // => ['a', 'c', 'e']
17+
* _.at(['a', 'b', 'c'], [0, 2]);
18+
* // => ['a', 'c']
1919
*
2020
* _.at(['fred', 'barney', 'pebbles'], 0, 2);
2121
* // => ['fred', 'pebbles']

collection/countBy.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ define(['../internal/createAggregator'], function(createAggregator) {
3434
* @returns {Object} Returns the composed aggregate object.
3535
* @example
3636
*
37-
* _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); });
37+
* _.countBy([4.3, 6.1, 6.4], function(n) {
38+
* return Math.floor(n);
39+
* });
3840
* // => { '4': 1, '6': 2 }
3941
*
40-
* _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math);
42+
* _.countBy([4.3, 6.1, 6.4], function(n) {
43+
* return this.floor(n);
44+
* }, Math);
4145
* // => { '4': 1, '6': 2 }
4246
*
4347
* _.countBy(['one', 'two', 'three'], 'length');

collection/filter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ define(['../internal/arrayFilter', '../internal/baseCallback', '../internal/base
2727
* @returns {Array} Returns the new filtered array.
2828
* @example
2929
*
30-
* var evens = _.filter([1, 2, 3, 4], function(n) { return n % 2 == 0; });
31-
* // => [2, 4]
30+
* _.filter([4, 5, 6], function(n) {
31+
* return n % 2 == 0;
32+
* });
33+
* // => [4, 6]
3234
*
3335
* var users = [
3436
* { 'user': 'barney', 'age': 36, 'active': true },

collection/find.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ define(['../internal/baseCallback', '../internal/baseEach', '../internal/baseFin
3636
* { 'user': 'pebbles', 'age': 1, 'active': true }
3737
* ];
3838
*
39-
* _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user');
39+
* _.result(_.find(users, function(chr) {
40+
* return chr.age < 40;
41+
* }), 'user');
4042
* // => 'barney'
4143
*
4244
* // using the `_.matches` callback shorthand

0 commit comments

Comments
 (0)
0