Number validation helpers.
Members
(static, readonly) validation :number
Validation result constants.
Type:
- number
Properties:
Name | Type | Description |
---|---|---|
OK |
number | Validation successful |
NOT_INTEGER |
number | Value is not formatted as an integer |
RANGE_INTEGER |
number | Value does not fall within the valid Integer range |
RANGE_LONG |
number | Value does not fall within the valid Long range |
RANGE_DECIMAL |
number | Value does not fall within the valid Decimal range |
RANGE_NUMBER |
number | Value does not fall within the valid Float and Currency range |
Methods
(static) validate(value, type) → {number}
Validates the value of the given type and returns validation.OK
or
the error value of the first failed validation.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | value to validate |
type |
string | type of the value to validate |
Returns:
validation result constant
- Type
- number
Example
// Should return true
validator.validate("100.12", "Integer") === validator.validation.NOT_INTEGER