Module: Guard
Type Aliases
GuardQualifier
Ƭ GuardQualifier<Function
, Validator
>: [validator: Validator, executor: Function]
Type parameters
Name | Type |
---|---|
Function | extends VariadicFunction |
Validator | extends (...args : Parameters <Function >) => boolean |
Functions
guard
▸ guard<Function
, Validators
>(...qualifiers
): Function
A function which accepts the pairs of guards:
the first one is the validator
, expected to return a boolean value.
If the value is true
, it's executor
should run with the provided args
and return from the guards
function.
If the value is false
, the process continues to the next validator
.
When no validator
succeeds, the default executor is run.
Type parameters
Name | Type |
---|---|
Function | extends VariadicFunction |
Validators | extends (...args : Parameters <Function >) => boolean [] |
Parameters
Name | Type |
---|---|
...qualifiers | [...GuardQualifier<Function, Validators[number]>[], Function ] |
Returns
Function