Fix tabbing

This commit is contained in:
Dominic Ferrando
2026-06-14 13:14:01 -04:00
parent 42f47c8601
commit 05dc26adb5
31 changed files with 9137 additions and 8508 deletions
+1 -1
View File
@@ -7,6 +7,6 @@
"ml-levenberg-marquardt": "^5.0.0"
},
"exports": {
".": "./src/index.ts"
".": "./src/index.ts"
}
}
File diff suppressed because it is too large Load Diff
+46 -46
View File
@@ -6,34 +6,34 @@ import avgWeightDataRaw from "./data/avg-weights.json";
// -------------------------------------------------------------------------------------------------
export type Player = {
name?: string;
metrics: Metrics;
name?: string;
metrics: Metrics;
};
export enum Attribute {
Strength = "Strength",
Power = "Power",
Endurance = "Endurance",
Agility = "Agility",
Strength = "Strength",
Power = "Power",
Endurance = "Endurance",
Agility = "Agility",
}
export enum Activity {
BackSquat = "BackSquat",
Deadlift = "Deadlift",
BenchPress = "BenchPress",
Run = "Run",
BroadJump = "BroadJump",
ConeDrill = "ConeDrill",
BackSquat = "BackSquat",
Deadlift = "Deadlift",
BenchPress = "BenchPress",
Run = "Run",
BroadJump = "BroadJump",
ConeDrill = "ConeDrill",
}
export interface ActivityPerformance {
activity: Activity;
performance: number;
activity: Activity;
performance: number;
}
export enum Gender {
Male = "Male",
Female = "Female",
Male = "Male",
Female = "Female",
}
// -------------------------------------------------------------------------------------------------
@@ -54,47 +54,47 @@ export const inToCm = (inches: number) => inches * 2.54;
export const cmToIn = (cm: number) => cm / 2.54;
export const msToTime = (ms: number, includeMs = false): string => {
const minutes = Math.floor(ms / 60000);
const seconds = Math.floor((ms % 60000) / 1000);
const milliseconds = Math.floor(ms % 1000);
const minutes = Math.floor(ms / 60000);
const seconds = Math.floor((ms % 60000) / 1000);
const milliseconds = Math.floor(ms % 1000);
let formattedTime = `${minutes}:${seconds.toString().padStart(2, "0")}`;
if (includeMs) {
formattedTime += `.${milliseconds.toString().padStart(3, "0")}`;
}
return formattedTime;
let formattedTime = `${minutes}:${seconds.toString().padStart(2, "0")}`;
if (includeMs) {
formattedTime += `.${milliseconds.toString().padStart(3, "0")}`;
}
return formattedTime;
};
export const range = (length: number) =>
Array.from({ length: length }, (_, i) => i);
Array.from({ length: length }, (_, i) => i);
export const clamp = (x: number, lo: number, hi: number) =>
Math.max(lo, Math.min(hi, x));
Math.max(lo, Math.min(hi, x));
export const getAvgWeight = (gender: Gender, age: number) => {
type AvgWeightData = {
metadata: {
unit: StandardUnit;
type AvgWeightData = {
metadata: {
unit: StandardUnit;
};
weights: Metrics[];
};
weights: Metrics[];
};
let avgWeightData = avgWeightDataRaw as AvgWeightData;
let avgWeightData = avgWeightDataRaw as AvgWeightData;
const avgWeights = avgWeightData.weights.filter((a) => a.gender === gender);
const firstAvgWeight = avgWeights[0];
if (!firstAvgWeight) throw new Error("No average weights");
const avgWeights = avgWeightData.weights.filter((a) => a.gender === gender);
const firstAvgWeight = avgWeights[0];
if (!firstAvgWeight) throw new Error("No average weights");
const closest = {
diff: Math.abs(firstAvgWeight.age - age),
avg: firstAvgWeight,
};
for (const avg of avgWeights) {
const diff = Math.abs(avg.age - age);
if (diff < closest.diff) {
closest.diff = diff;
closest.avg = avg;
const closest = {
diff: Math.abs(firstAvgWeight.age - age),
avg: firstAvgWeight,
};
for (const avg of avgWeights) {
const diff = Math.abs(avg.age - age);
if (diff < closest.diff) {
closest.diff = diff;
closest.avg = avg;
}
}
}
return closest.avg.weight;
return closest.avg.weight;
};
+4 -4
View File
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"noUncheckedIndexedAccess": false,
},
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"noUncheckedIndexedAccess": false
}
}