mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Cleanup _.compact optimization.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -4501,13 +4501,13 @@
|
||||
function compact(array) {
|
||||
var index = -1,
|
||||
length = array ? array.length : 0,
|
||||
result = [],
|
||||
cur = 0,
|
||||
value;
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
if (value = array[index]) {
|
||||
result[cur++] = value;
|
||||
var value = array[index];
|
||||
if (value) {
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user