Skip to content

Commit d82eadc

Browse files
committed
Move the decide parameter out of the way in extremum
1 parent 20e88e5 commit d82eadc

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

modules/_extremum.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ import find from './find.js';
66
// `true` if its first argument is more extreme than (i.e., should be preferred
77
// over) its second argument, `false` otherwise. `iteratee` and `context`, like
88
// in other collection functions, let you map the actual values in `collection`
9-
// to the values to `compare`. `decide` is an optional customization point
10-
// which is only present for historical reasons; please don't use it, as it will
11-
// likely be removed in the future.
9+
// to the values to `compare`.
1210
export default function extremum(collection, compare, iteratee, context, decide) {
13-
decide || (decide = identity);
1411
// `extremum` is essentially a combined map+reduce with **two** accumulators:
1512
// `result` and `iterResult`, respectively the unmapped and the mapped version
1613
// corresponding to the same element.
@@ -25,9 +22,12 @@ export default function extremum(collection, compare, iteratee, context, decide)
2522
first = false;
2623
}
2724
});
28-
// `extremum` normally returns an unmapped element from `collection`. However,
29-
// `_.min` and `_.max` forcibly return a number even if there is no element
30-
// that maps to a numeric value. Passing both accumulators through `decide`
31-
// before returning enables this behavior.
32-
return decide(result, iterResult);
25+
// `extremum` would normally return `result`. However, `_.min` and `_.max`
26+
// forcibly return a number even if there is no element that maps to a numeric
27+
// value. Passing both accumulators through `decide` before returning enables
28+
// this behavior.
29+
// `decide` is an optional customization point which is only present for the
30+
// above historical reason; please don't use it, as it will likely be removed
31+
// in the future.
32+
return (decide || identity)(result, iterResult);
3333
}

underscore-esm.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

underscore-esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

underscore.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

underscore.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)