MCPcopy Create free account
hub / github.com/d3/d3-array / max

Function max

src/max.js:1–20  ·  view source on GitHub ↗
(values, valueof)

Source from the content-addressed store, hash-verified

1export default function max(values, valueof) {
2 let max;
3 if (valueof === undefined) {
4 for (const value of values) {
5 if (value != null
6 && (max < value || (max === undefined && value >= value))) {
7 max = value;
8 }
9 }
10 } else {
11 let index = -1;
12 for (let value of values) {
13 if ((value = valueof(value, ++index, values)) != null
14 && (max < value || (max === undefined && value >= value))) {
15 max = value;
16 }
17 }
18 }
19 return max;
20}

Callers 2

max-test.jsFile · 0.90
quantileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected