This commit is contained in:
Felipe Batista
2025-01-27 17:44:27 -03:00
commit 47e7f75720
238 changed files with 36425 additions and 0 deletions

27
src/utils/flunt.ts Normal file
View File

@@ -0,0 +1,27 @@
export class Flunt {
constructor(public errors: any[] = [])
{}
isRequired(value, message){
if (!value || value.length <= 0) {
this.errors.push(message);
}
}
hasMinLen( value, min, message) {
if (!value || value.length <= min) {
this.errors.push(message);
}
}
hasMaxLen( value, max, message) {
if (!value || value.length >= max) {
this.errors.push(message);
}
}
isValid(): boolean {
return this.errors.length == 0;
}
}

View File

@@ -0,0 +1,6 @@
export class NumberUtils {
static getNewId(max: number, min: number) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
}