Feature: add slope measurement input

This commit is contained in:
Pieter Vander Vennet 2023-12-14 15:41:34 +01:00
parent 48ac539272
commit fdf38daf5e
5 changed files with 65 additions and 7 deletions

View file

@ -0,0 +1,13 @@
import NatValidator from "./NatValidator"
export default class SlopeValidator extends NatValidator {
constructor() {
super("slope", "Validates that the slope is a valid number")
}
isValid(str: string): boolean {
if (str.endsWith("%") || str.endsWith("°")) {
str = str.substring(0, str.length - 1)
}
return super.isValid(str)
}
}