Initial commit
This commit is contained in:
22
node_modules/d3-array/src/minIndex.js
generated
vendored
Normal file
22
node_modules/d3-array/src/minIndex.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
export default function minIndex(values, valueof) {
|
||||
let min;
|
||||
let minIndex = -1;
|
||||
let index = -1;
|
||||
if (valueof === undefined) {
|
||||
for (const value of values) {
|
||||
++index;
|
||||
if (value != null
|
||||
&& (min > value || (min === undefined && value >= value))) {
|
||||
min = value, minIndex = index;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let value of values) {
|
||||
if ((value = valueof(value, ++index, values)) != null
|
||||
&& (min > value || (min === undefined && value >= value))) {
|
||||
min = value, minIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return minIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user