mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Avoid ternary operations that aren't part of an assignment.
This commit is contained in:
13
lodash.js
13
lodash.js
@@ -287,7 +287,12 @@
|
||||
typeCache = cache[type] || (cache[type] = {});
|
||||
|
||||
if (type == 'object') {
|
||||
(typeCache[key] || (typeCache[key] = [])).push(value);
|
||||
var array = typeCache[key];
|
||||
if (array) {
|
||||
array.push(value);
|
||||
} else {
|
||||
typeCache[key] = [value];
|
||||
}
|
||||
} else {
|
||||
typeCache[key] = true;
|
||||
}
|
||||
@@ -3652,7 +3657,11 @@
|
||||
* // => { '3': ['one', 'two'], '5': ['three'] }
|
||||
*/
|
||||
var groupBy = createAggregator(function(result, value, key) {
|
||||
(hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
|
||||
if (hasOwnProperty.call(result, key)) {
|
||||
result[key].push(value);
|
||||
} else {
|
||||
result[key] = [value];
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user