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

Skip to content

Commit bbec03c

Browse files
committed
Bump to v3.0.1.
1 parent f9606b3 commit bbec03c

14 files changed

+64
-47
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v3.0.0
1+
# lodash v3.0.1
22

33
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
44

@@ -28,7 +28,7 @@ var array = require('lodash/array');
2828
var chunk = require('lodash/array/chunk');
2929
```
3030

31-
See the [package source](https://github.com/lodash/lodash/tree/3.0.0-npm) for more details.
31+
See the [package source](https://github.com/lodash/lodash/tree/3.0.1-npm) for more details.
3232

3333
**Note:**<br>
3434
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
@@ -39,8 +39,8 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b
3939
lodash is also available in a variety of other builds & module formats.
4040

4141
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
42-
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.0-amd) builds
43-
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.0-es) build
42+
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds
43+
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build
4444

4545
## Further Reading
4646

chain/wrapperReverse.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ var LazyWrapper = require('../internal/LazyWrapper'),
2525
function wrapperReverse() {
2626
var value = this.__wrapped__;
2727
if (value instanceof LazyWrapper) {
28+
if (this.__actions__.length) {
29+
value = new LazyWrapper(this);
30+
}
2831
return new LodashWrapper(value.reverse());
2932
}
3033
return this.thru(function(value) {

collection/forEach.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var arrayEach = require('../internal/arrayEach'),
2323
* @returns {Array|Object|string} Returns `collection`.
2424
* @example
2525
*
26-
* _([1, 2, 3]).forEach(function(n) { console.log(n); });
26+
* _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
2727
* // => logs each value from left to right and returns the array
2828
*
2929
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); });

function/memoize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
3535
* // => 'FRED'
3636
*
3737
* // modifying the result cache
38-
* upperCase.cache.set('fred, 'BARNEY');
38+
* upperCase.cache.set('fred', 'BARNEY');
3939
* upperCase('fred');
4040
* // => 'BARNEY'
4141
*

index.js

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
3+
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
44
* Build: `lodash modern -d -o ./index.js`
55
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
66
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
@@ -13,7 +13,7 @@
1313
var undefined;
1414

1515
/** Used as the semantic version number. */
16-
var VERSION = '3.0.0';
16+
var VERSION = '3.0.1';
1717

1818
/** Used to compose bitmasks for wrapper metadata. */
1919
var BIND_FLAG = 1,
@@ -1060,11 +1060,14 @@
10601060
* @returns {Object} Returns the new reversed `LazyWrapper` object.
10611061
*/
10621062
function lazyReverse() {
1063-
var filtered = this.filtered,
1064-
result = filtered ? new LazyWrapper(this) : this.clone();
1065-
1066-
result.dir = this.dir * -1;
1067-
result.filtered = filtered;
1063+
if (this.filtered) {
1064+
var result = new LazyWrapper(this);
1065+
result.dir = -1;
1066+
result.filtered = true;
1067+
} else {
1068+
result = this.clone();
1069+
result.dir *= -1;
1070+
}
10681071
return result;
10691072
}
10701073

@@ -1083,12 +1086,12 @@
10831086
}
10841087
var dir = this.dir,
10851088
isRight = dir < 0,
1086-
length = array.length,
1087-
view = getView(0, length, this.views),
1089+
view = getView(0, array.length, this.views),
10881090
start = view.start,
10891091
end = view.end,
1092+
length = end - start,
10901093
dropCount = this.dropCount,
1091-
takeCount = nativeMin(end - start, this.takeCount - dropCount),
1094+
takeCount = nativeMin(length, this.takeCount - dropCount),
10921095
index = isRight ? end : start - 1,
10931096
iteratees = this.iteratees,
10941097
iterLength = iteratees ? iteratees.length : 0,
@@ -1124,7 +1127,7 @@
11241127
result[resIndex++] = value;
11251128
}
11261129
}
1127-
return isRight ? result.reverse() : result;
1130+
return result;
11281131
}
11291132

11301133
/*------------------------------------------------------------------------*/
@@ -1645,7 +1648,7 @@
16451648
// Handle "_.property" and "_.matches" style callback shorthands.
16461649
return type == 'object'
16471650
? baseMatches(func, !argCount)
1648-
: baseProperty(argCount ? baseToString(func) : func);
1651+
: baseProperty(func + '');
16491652
}
16501653

16511654
/**
@@ -2375,6 +2378,9 @@
23752378
? toPlainObject(value)
23762379
: (isPlainObject(value) ? value : {});
23772380
}
2381+
else {
2382+
isCommon = false;
2383+
}
23782384
}
23792385
// Add the source value to the stack of traversed objects and associate
23802386
// it with its merged value.
@@ -2496,7 +2502,8 @@
24962502
if (end < 0) {
24972503
end += length;
24982504
}
2499-
length = start > end ? 0 : (end - start);
2505+
length = start > end ? 0 : (end - start) >>> 0;
2506+
start >>>= 0;
25002507

25012508
var result = Array(length);
25022509
while (++index < length) {
@@ -3103,7 +3110,7 @@
31033110
return '';
31043111
}
31053112
var padLength = length - strLength;
3106-
chars = chars == null ? ' ' : baseToString(chars);
3113+
chars = chars == null ? ' ' : (chars + '');
31073114
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
31083115
}
31093116

@@ -3296,7 +3303,7 @@
32963303
case stringTag:
32973304
// Coerce regexes to strings and treat strings primitives and string
32983305
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
3299-
return object == baseToString(other);
3306+
return object == (other + '');
33003307
}
33013308
return false;
33023309
}
@@ -5314,6 +5321,9 @@
53145321
function wrapperReverse() {
53155322
var value = this.__wrapped__;
53165323
if (value instanceof LazyWrapper) {
5324+
if (this.__actions__.length) {
5325+
value = new LazyWrapper(this);
5326+
}
53175327
return new LodashWrapper(value.reverse());
53185328
}
53195329
return this.thru(function(value) {
@@ -5689,7 +5699,7 @@
56895699
* @returns {Array|Object|string} Returns `collection`.
56905700
* @example
56915701
*
5692-
* _([1, 2, 3]).forEach(function(n) { console.log(n); });
5702+
* _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
56935703
* // => logs each value from left to right and returns the array
56945704
*
56955705
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); });
@@ -7105,7 +7115,7 @@
71057115
* // => 'FRED'
71067116
*
71077117
* // modifying the result cache
7108-
* upperCase.cache.set('fred, 'BARNEY');
7118+
* upperCase.cache.set('fred', 'BARNEY');
71097119
* upperCase('fred');
71107120
* // => 'BARNEY'
71117121
*
@@ -9193,7 +9203,7 @@
91939203

91949204
/**
91959205
* Converts `string` to kebab case (a.k.a. spinal case).
9196-
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for
9206+
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for
91979207
* more details.
91989208
*
91999209
* @static
@@ -10677,7 +10687,8 @@
1067710687

1067810688
// Add `LazyWrapper` methods to `lodash.prototype`.
1067910689
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10680-
var retUnwrapped = /^(?:first|last)$/.test(methodName);
10690+
var lodashFunc = lodash[methodName],
10691+
retUnwrapped = /^(?:first|last)$/.test(methodName);
1068110692

1068210693
lodash.prototype[methodName] = function() {
1068310694
var value = this.__wrapped__,
@@ -10690,12 +10701,12 @@
1069010701
if (retUnwrapped && !chainAll) {
1069110702
return onlyLazy
1069210703
? func.call(value)
10693-
: lodash[methodName](this.value());
10704+
: lodashFunc.call(lodash, this.value());
1069410705
}
1069510706
var interceptor = function(value) {
1069610707
var otherArgs = [value];
1069710708
push.apply(otherArgs, args);
10698-
return lodash[methodName].apply(lodash, otherArgs);
10709+
return lodashFunc.apply(lodash, otherArgs);
1069910710
};
1070010711
if (isLazy || isArray(value)) {
1070110712
var wrapper = onlyLazy ? value : new LazyWrapper(this),

internal/baseCallback.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var baseMatches = require('./baseMatches'),
22
baseProperty = require('./baseProperty'),
3-
baseToString = require('./baseToString'),
43
bindCallback = require('./bindCallback'),
54
identity = require('../utility/identity'),
65
isBindable = require('./isBindable');
@@ -28,7 +27,7 @@ function baseCallback(func, thisArg, argCount) {
2827
// Handle "_.property" and "_.matches" style callback shorthands.
2928
return type == 'object'
3029
? baseMatches(func, !argCount)
31-
: baseProperty(argCount ? baseToString(func) : func);
30+
: baseProperty(func + '');
3231
}
3332

3433
module.exports = baseCallback;

internal/baseMergeDeep.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stack
4747
? toPlainObject(value)
4848
: (isPlainObject(value) ? value : {});
4949
}
50+
else {
51+
isCommon = false;
52+
}
5053
}
5154
// Add the source value to the stack of traversed objects and associate
5255
// it with its merged value.

internal/baseSlice.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function baseSlice(array, start, end) {
1919
if (end < 0) {
2020
end += length;
2121
}
22-
length = start > end ? 0 : (end - start);
22+
length = start > end ? 0 : (end - start) >>> 0;
23+
start >>>= 0;
2324

2425
var result = Array(length);
2526
while (++index < length) {

internal/createPad.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
var baseToString = require('./baseToString'),
2-
repeat = require('../string/repeat');
1+
var repeat = require('../string/repeat');
32

43
/** Native method references. */
54
var ceil = Math.ceil;
@@ -26,7 +25,7 @@ function createPad(string, length, chars) {
2625
return '';
2726
}
2827
var padLength = length - strLength;
29-
chars = chars == null ? ' ' : baseToString(chars);
28+
chars = chars == null ? ' ' : (chars + '');
3029
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
3130
}
3231

internal/equalByTag.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
var baseToString = require('./baseToString');
2-
31
/** `Object#toString` result references. */
42
var boolTag = '[object Boolean]',
53
dateTag = '[object Date]',
@@ -43,7 +41,7 @@ function equalByTag(object, other, tag) {
4341
case stringTag:
4442
// Coerce regexes to strings and treat strings primitives and string
4543
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
46-
return object == baseToString(other);
44+
return object == (other + '');
4745
}
4846
return false;
4947
}

internal/lazyReverse.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ var LazyWrapper = require('./LazyWrapper');
99
* @returns {Object} Returns the new reversed `LazyWrapper` object.
1010
*/
1111
function lazyReverse() {
12-
var filtered = this.filtered,
13-
result = filtered ? new LazyWrapper(this) : this.clone();
14-
15-
result.dir = this.dir * -1;
16-
result.filtered = filtered;
12+
if (this.filtered) {
13+
var result = new LazyWrapper(this);
14+
result.dir = -1;
15+
result.filtered = true;
16+
} else {
17+
result = this.clone();
18+
result.dir *= -1;
19+
}
1720
return result;
1821
}
1922

internal/lazyValue.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ function lazyValue() {
2424
}
2525
var dir = this.dir,
2626
isRight = dir < 0,
27-
length = array.length,
28-
view = getView(0, length, this.views),
27+
view = getView(0, array.length, this.views),
2928
start = view.start,
3029
end = view.end,
30+
length = end - start,
3131
dropCount = this.dropCount,
32-
takeCount = nativeMin(end - start, this.takeCount - dropCount),
32+
takeCount = nativeMin(length, this.takeCount - dropCount),
3333
index = isRight ? end : start - 1,
3434
iteratees = this.iteratees,
3535
iterLength = iteratees ? iteratees.length : 0,
@@ -65,7 +65,7 @@ function lazyValue() {
6565
result[resIndex++] = value;
6666
}
6767
}
68-
return isRight ? result.reverse() : result;
68+
return result;
6969
}
7070

7171
module.exports = lazyValue;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lodash",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "The modern build of lodash modular utilities.",
55
"homepage": "https://lodash.com/",
66
"icon": "https://lodash.com/icon.svg",

string/kebabCase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var createCompounder = require('../internal/createCompounder');
22

33
/**
44
* Converts `string` to kebab case (a.k.a. spinal case).
5-
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for
5+
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for
66
* more details.
77
*
88
* @static

0 commit comments

Comments
 (0)
0