obss
logo
github_iconnpm_iconVersion: 5.0.2
Rule
ruleSet: [ { rule: 'required', customMessage: 'This list should not be empty' }, { rule: 'listSize', greaterThan: 2 }, ],
Rule Definition Parameters
rule (string || func)
Identifier (name) of the rule to be run. (Can also be a custom function)
equalTo, lessThan, lessThanOrEqualTo, greaterThan, greaterThanOrEqualTo, notEqualTo (any || function)
Comparison identifier that can be used only by number, length, listSize and date rules.
equalTo See Example
The equality identifier that can be used with the equality rule.
isOneOf See Example
Checking that it is included in the list available with the equality rule
onlyIntegers (boolean)
Decides whether only integer are allowed that can be used only by number rule.
withTime (boolean)
Decides whether hours and minutes are taken into account that can be used only by date rule.
applyToNulls (boolean) See Example
Decides whether the rule should also be run on null values.
disableIf (func) See Example
Disables running the rule if the return value of the function is truthy.
enableIf (func) See Example
Enables running the rule if the return value of the function is truthy.
customMessage (string || func) See Example
Function to override default error message for the rule.