Tests whether a value meets a validation or data type rule.
isValid(type, value, min, max, pattern)
returns boolean
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Yes | The valid format for the data. | |
value | any | Yes | The value to test. | |
min | numeric | No | The minimum valid value; used only for range validation. | |
max | numeric | No | The maximum valid value; used only for range validation. | |
pattern | string | No | A regular expression that the parameter must match; used only for regex or regular_expression validation. |
Use the isValid function with integer as the type.
isValid("integer", 235)
Use the isValid function with email as the type.
isValid("email", "user@example.com")