Skip to content

Commit c545b48

Browse files
committed
Avoid initializer use
1 parent 6c18935 commit c545b48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

underscore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,9 @@
391391
};
392392

393393
// An internal function used for aggregate "group by" operations.
394-
var group = function(behavior, initializer) {
394+
var group = function(behavior, partition) {
395395
return function(obj, iteratee, context) {
396-
var result = initializer ? initializer() : {};
396+
var result = partition ? [[], []] : {};
397397
iteratee = cb(iteratee, context);
398398
_.each(obj, function(value, index) {
399399
var key = iteratee(value, index, obj);
@@ -440,7 +440,7 @@
440440
// predicate, and one whose elements all do not satisfy the predicate.
441441
_.partition = group(function(result, value, pass) {
442442
result[pass ? 0 : 1].push(value);
443-
}, function() { return [[], []]; });
443+
}, true);
444444

445445
// Array Functions
446446
// ---------------

0 commit comments

Comments
 (0)