8000 Update builds and docs. · lodash/lodash@f949bdc · GitHub
[go: up one dir, main page]

Skip to content

Commit f949bdc

Browse files
committed
Update builds and docs.
1 parent 21a45a9 commit f949bdc

8 files changed

+298
-308
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ var _ = require('lodash/dist/lodash.underscore');
101101

102102
**Notes:**
103103
* Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL
104-
* If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it
104+
* If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it
105105
* Node.js 0.10.8-0.10.11 [have](https://github.com/joyent/node/issues/5622) [bugs](https://github.com/joyent/node/issues/5688) preventing minified builds
106106

107107
In [Rhino](http://www.mozilla.org/rhino/):
@@ -134,7 +134,7 @@ The full changelog is available [here](https://github.com/lodash/lodash/wiki/Cha
134134

135135
## BestieJS
136136

137-
Lo-Dash is part of the BestieJS *“Best in Class”* module collection. This means it promotes solid environment support, ES5+ precedents, unit testing, & plenty of documentation.
137+
Lo-Dash is part of the [BestieJS](https://github.com/bestiejs) *“Best in Class”* module collection. This means it promotes solid environment support, ES5+ precedents, unit testing, & plenty of documentation.
138138

139139
## Author
140140

dist/lodash.compat.js

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@
16981698
forIn(value, function(value, key) {
16991699
result = key;
17001700
});
1701-
return result === undefined || hasOwnProperty.call(value, result);
1701+
return typeof result == 'undefined' || hasOwnProperty.call(value, result);
17021702
}
17031703

17041704
/**
@@ -3868,11 +3868,14 @@
38683868
* // => [3, 1]
38693869
*/
38703870
function sample(collection, n, guard) {
3871-
if (!isArray(collection)) {
3872-
collection = toArray(collection);
3871+
var length = collection ? collection.length : 0;
3872+
if (typeof length != 'number') {
3873+
collection = values(collection);
3874+
} else if (support.unindexedChars && isString(collection)) {
3875+
collection = collection.split('');
38733876
}
38743877
if (n == null || guard) {
3875-
return collection[random(collection.length - 1)];
3878+
return collection ? collection[random(length - 1)] : undefined;
38763879
}
38773880
var result = shuffle(collection);
38783881
result.length = nativeMin(nativeMax(0, n), result.length);
@@ -4297,24 +4300,22 @@
42974300
* // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }]
42984301
*/
42994302
function first(array, callback, thisArg) {
4300-
if (array) {
4301-
var n = 0,
4302-
length = array.length;
4303+
var n = 0,
4304+
length = array ? array.length : 0;
43034305

4304-
if (typeof callback != 'number' && callback != null) {
4305-
var index = -1;
4306-
callback = lodash.createCallback(callback, thisArg, 3);
4307-
while (++index < length && callback(array[index], index, array)) {
4308-
n++;
4309-
}
4310-
} else {
4311-
n = callback;
4312-
if (n == null || thisArg) {
4313-
return array[0];
4314-
}
4306+
if (typeof callback != 'number' && callback != null) {
4307+
var index = -1;
4308+
callback = lodash.createCallback(callback, thisArg, 3);
4309+
while (++index < length && callback(array[index], index, array)) {
4310+
n++;
4311+
}
4312+
} else {
4313+
n = callback;
4314+
if (n == null || thisArg) {
4315+
return array ? array[0] : undefined;
43154316
}
4316-
return slice(array, 0, nativeMin(nativeMax(0, n), length));
43174317
}
4318+
return slice(array, 0, nativeMin(nativeMax(0, n), length));
43184319
}
43194320

43204321
/**
@@ -4362,7 +4363,7 @@
43624363
// juggle arguments
43634364
if (typeof isShallow != 'boolean' && isShallow != null) {
43644365
thisArg = callback;
4365-
callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined;
4366+
callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : null;
43664367
isShallow = false;
43674368
}
43684369
if (callback != null) {
@@ -4462,11 +4463,8 @@
44624463
* // => [{ 'name': 'banana', 'type': 'fruit' }]
44634464
*/
44644465
function initial(array, callback, thisArg) {
4465-
if (!array) {
4466-
return [];
4467-
}
44684466
var n = 0,
4469-
length = array.length;
4467+
length = array ? array.length : 0;
44704468

44714469
if (typeof callback != 'number' && callback != null) {
44724470
var index = length;
@@ -4595,24 +4593,22 @@
45954593
* // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }]
45964594
*/
45974595
function last(array, callback, thisArg) {
4598-
if (array) {
4599-
var n = 0,
4600-
length = array.length;
4596+
var n = 0,
4597+
length = array ? array.length : 0;
46014598

4602-
if (typeof callback != 'number' && callback != null) {
4603-
var index = length;
4604-
callback = lodash.createCallback(callback, thisArg, 3);
4605-
while (index-- && callback(array[index], index, array)) {
4606-
n++;
4607-
}
4608-
} else {
4609-
n = callback;
4610-
if (n == null || thisArg) {
4611-
return array[length - 1];
4612-
}
4599+
if (typeof callback != 'number' && callback != null) {
4600+
var index = length;
4601+
callback = lodash.createCallback(callback, thisArg, 3);
4602+
while (index-- && callback(array[index], index, array)) {
4603+
n++;
4604+
}
4605+
} else {
4606+
n = callback;
4607+
if (n == null || thisArg) {
4608+
return array ? array[length - 1] : undefined;
46134609
}
4614-
return slice(array, nativeMax(0, length - n));
46154610
}
4611+
return slice(array, nativeMax(0, length - n));
46164612
}
46174613

46184614
/**
@@ -4990,7 +4986,7 @@
49904986
// juggle arguments
49914987
if (typeof isSorted != 'boolean' && isSorted != null) {
49924988
thisArg = callback;
4993-
callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined;
4989+
callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : null;
49944990
isSorted = false;
49954991
}
49964992
if (callback != null) {
@@ -5972,8 +5968,10 @@
59725968
* // => 'nonsense'
59735969
*/
59745970
function result(object, property) {
5975-
var value = object ? object[property] : undefined;
5976-
return isFunction(value) ? object[property]() : value;
5971+
if (object) {
5972+
var value = object[property];
5973+
return isFunction(value) ? object[property]() : value;
5974+
}
59775975
}
59785976

59795977
/**

0 commit comments

Comments
 (0)
0