mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +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'],
|
||||
'rest': [],
|
||||
'result': ['isFunction'],
|
||||
'shuffle': ['random'],
|
||||
'shuffle': [],
|
||||
'size': ['keys'],
|
||||
'some': ['identity'],
|
||||
'sortBy': ['identity'],
|
||||
|
||||
@@ -2396,8 +2396,9 @@
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
if (array[index]) {
|
||||
result.push(array[index]);
|
||||
var value = array[index];
|
||||
if (value) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -2860,7 +2861,7 @@
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
var rand = random(index);
|
||||
var rand = nativeFloor(nativeRandom() * (index + 1));
|
||||
result[index] = result[rand];
|
||||
result[rand] = array[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user