(type: enum): boolean
(arguments: {
type: string,
on?: any,
key?: string
}): booleanThe _type operator performs a type test on an object, and returns true if the object is of the specified type.
The regex operator has shorthand argument definitions that can be used on web client.
Arguments
object
type: enum: Required - The type to test. Can be one of:stringarraydateobjectbooleannumberintegernullundefinednone(nullorundefined)primitive(undefined,null,string,number,boolean, ordate)
on: any: The value to test. One ofonorkeymust be specified unless the operator is used in an input block.key: string: The key of a value instateto test. One ofonorkeymust be specified unless the operator is used in an input block.
string
The type to test. The string shorthand can only be used in an input block, and the tested value will be the block's value.
Examples
Check if a value is a number:
_type:
type: number
on:
_state: inputReturns: true if a number.
Using the key of the value in state:
_type:
type: number
key: inputReturns: true if a number.
Using the value of the block in which the operator is evaluated:
id: input
type: TextInput
validate:
- message: This field id required.
status: error
pass:
_not:
_type: noneReturns: true if the input is none.
Test if an id in the urlQuery is undefined or null:
_type:
type: none
on:
_url_query: idReturns: true if the id is none,
