mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Reduce _.compact and revert _.random use in _.shuffle.
Former-commit-id: 17d153cb09c262830f1497f93c0f3d9b279c8f8a
This commit is contained in:
2
build.js
2
build.js
@@ -138,7 +138,7 @@
|
|||||||
'reject': ['identity'],
|
'reject': ['identity'],
|
||||||
'rest': [],
|
'rest': [],
|
||||||
'result': ['isFunction'],
|
'result': ['isFunction'],
|
||||||
'shuffle': ['random'],
|
'shuffle': [],
|
||||||
'size': ['keys'],
|
'size': ['keys'],
|
||||||
'some': ['identity'],
|
'some': ['identity'],
|
||||||
'sortBy': ['identity'],
|
'sortBy': ['identity'],
|
||||||
|
|||||||
@@ -2396,8 +2396,9 @@
|
|||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
if (array[index]) {
|
var value = array[index];
|
||||||
result.push(array[index]);
|
if (value) {
|
||||||
|
result.push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -2860,7 +2861,7 @@
|
|||||||
result = Array(length);
|
result = Array(length);
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var rand = random(index);
|
var rand = nativeFloor(nativeRandom() * (index + 1));
|
||||||
result[index] = result[rand];
|
result[index] = result[rand];
|
||||||
result[rand] = array[index];
|
result[rand] = array[index];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user