ski-din-calculator
Version:
Calculate a skier's DIN binding release value based on height, weight, age, skill level, and boot sole length
46 lines (45 loc) • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidBootSoleLengthError = exports.InvalidSkierTypeError = exports.InvalidAgeError = exports.InvalidWeightError = exports.InvalidHeightError = exports.DINCalculationError = void 0;
/**
* Error types for DIN calculation validation
*/
class DINCalculationError extends Error {
constructor(message, field, value) {
super(message);
this.field = field;
this.value = value;
this.name = 'DINCalculationError';
}
}
exports.DINCalculationError = DINCalculationError;
class InvalidHeightError extends DINCalculationError {
constructor(height) {
super(`Invalid skier height: ${height}cm. Must be between 1-250cm.`, 'height', height);
}
}
exports.InvalidHeightError = InvalidHeightError;
class InvalidWeightError extends DINCalculationError {
constructor(weight) {
super(`Invalid skier weight: ${weight}kg. Must be between 1-150kg.`, 'weight', weight);
}
}
exports.InvalidWeightError = InvalidWeightError;
class InvalidAgeError extends DINCalculationError {
constructor(age) {
super(`Invalid skier age: ${age}. Must be between 3-100 years.`, 'age', age);
}
}
exports.InvalidAgeError = InvalidAgeError;
class InvalidSkierTypeError extends DINCalculationError {
constructor(skierType) {
super(`Invalid skier type: ${skierType}. Must be 1 (Cautious), 2 (Moderate), or 3 (Aggressive).`, 'skierType', skierType);
}
}
exports.InvalidSkierTypeError = InvalidSkierTypeError;
class InvalidBootSoleLengthError extends DINCalculationError {
constructor(bootSoleLength) {
super(`Invalid boot sole length: ${bootSoleLength}mm. Must be between 200-360mm.`, 'bootSoleLength', bootSoleLength);
}
}
exports.InvalidBootSoleLengthError = InvalidBootSoleLengthError;