mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
better change warnings
This commit is contained in:
committed by
Aiden McClelland
parent
1eeb5e03ea
commit
2475c08648
@@ -1102,7 +1102,7 @@ export module Mock {
|
||||
},
|
||||
'default': 'null',
|
||||
'description': 'This is not even real.',
|
||||
'change-warning': 'Be careful chnaging this!',
|
||||
'change-warning': 'Be careful changing this!',
|
||||
'values': [
|
||||
'null',
|
||||
'option1',
|
||||
|
||||
@@ -153,6 +153,7 @@ function isFullUnion (spec: ValueSpecUnion | ListValueSpecUnion): spec is ValueS
|
||||
|
||||
export function numberInRange (stringRange: string): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationErrors | null => {
|
||||
if (!control.value) return null
|
||||
try {
|
||||
Range.from(stringRange).checkIncludes(control.value)
|
||||
return null
|
||||
@@ -164,15 +165,15 @@ export function numberInRange (stringRange: string): ValidatorFn {
|
||||
|
||||
export function isNumber (): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationErrors | null => {
|
||||
return control.value == Number(control.value) ?
|
||||
return !control.value || control.value == Number(control.value) ?
|
||||
null :
|
||||
{ invalidNumber: { value: control.value } }
|
||||
{ notNumber: { value: control.value } }
|
||||
}
|
||||
}
|
||||
|
||||
export function isInteger (): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationErrors | null => {
|
||||
return control.value == Math.trunc(control.value) ?
|
||||
return !control.value || control.value == Math.trunc(control.value) ?
|
||||
null :
|
||||
{ numberNotInteger: { value: control.value } }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user