add summary

This commit is contained in:
Vick Scarlet
2021-08-18 15:41:58 +08:00
parent 3eff53a5aa
commit ee1ef21efd
8 changed files with 214 additions and 59 deletions

View File

@@ -73,4 +73,6 @@ function summary(type, value) {
const {min, judge, grade} = data[type][length];
if(min==void 0 || value >= min) return {judge, grade};
}
}
}
export { summary };

View File

@@ -9,4 +9,23 @@ function clone(value) {
}
}
export { clone };
function max(...arr) {
return Math.max(...arr.flat());
}
function min(...arr) {
return Math.min(...arr.flat());
}
function sum(...arr) {
let s = 0;
arr.flat().forEach(v=>s+=v);
return s;
}
function average(...arr) {
const s = sum(...arr);
return s / arr.flat().length;
}
export { clone, max, min, sum, average };