TYPEOF

The TYPEOF function returns the data type of the input.

This function takes a single piece of input of any data type. It then outputs Text indicating the input's data type.

Declaration

TYPEOF(value) -> type

Parameters

value (required, type: any)
A value of any data type. 

Return Values

type (type: string)
The determined data type of the given value, if found.

Examples

The following example takes the number 42 and determines that it is, in fact, a number:

TYPEOF(42) -> "number"

The following example takes the list [1, 2, 3] and determines that it is, in fact, a list:

TYPEOF([1, 2, 3]) -> "list"

Regardless of the type of input TYPEOF is given, it will always return a string. This is demonstrated in the following example, where the output of one instance of the TYPEOF function is used as input in another TYPEOF function:

TYPEOF(TYPEOF([1, 2, 3])) -> "string"

Discussion

The examples given above are far from comprehensive. For more insight into what data types the TYPEOF function might recognize, check out the Data Types Overview. There is, however, one data type recognized by TYPEOF that is not discussed in the Data Types Overview, and that's the AirData app object, which TYPEOF calls an "appobject".

Say the last example has access to the following app object:

identity -> {  
 "first_name": "Jane",  
 "last_name": "Doe",  
 "full_name": "Jane Doe",  
 "email": "[email protected]",  
 "phone": "+13143251156",  
 "time_zone": "UTC"  
}

The following example gives the app object identity as input for TYPEOF, which returns "appobject":

TYPEOF(identity) -> "appobject"