Avoid ternary operations that aren't part of an assignment.

This commit is contained in:
John-David Dalton
2014-01-03 11:46:45 -06:00
parent 0b4029f7a1
commit 4850a033fa
7 changed files with 44 additions and 12 deletions

View File

@@ -2269,7 +2269,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];
}
});
/**