A newer version of this documentation is available.

View Latest

Type Functions

Type functions perform operations that check or convert expressions.

Type-Checking Functions

ISARRAY(expression)

Returns True if expression is an array, otherwise returns MISSING, NULL or false.

ISATOM(expression)

Returns True if expression is a Boolean, number, or string, otherwise returns MISSING, NULL or false.

ISBOOLEAN(expression)

Returns True if expression is a Boolean, otherwise returns MISSING, NULL or false.

ISNUMBER(expression)

Returns True if expression is a number, otherwise returns MISSING, NULL or false.

ISOBJECT(expression)

Returns True if expression is an object, otherwise returns MISSING, NULL or false.

ISSTRING(expression)

Returns True if expression is a string, otherwise returns MISSING, NULL or false.

TYPE(expression)

Returns one of the following strings, based on the value of expression:

  • "missing"

  • "null"

  • "boolean"

  • "number"

  • "string"

  • "array"

  • "object"

  • "binary"

Type-Conversion Functions

TOARRAY(expression)

Returns array as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • Arrays are themselves.

  • All other values are wrapped in an array.

TOATOM(expression)

Returns atomic value as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • Arrays of length 1 are the result of TOATOM() on their single element.

  • Objects of length 1 are the result of TOATOM() on their single value.

  • Booleans, numbers, and strings are themselves.

  • All other values are NULL.

TOBOOLEAN(expression)

Returns Boolean as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • False is false.

  • Numbers +0, -0, and NaN are false.

  • Empty strings, arrays, and objects are false.

  • All other values are true.

TONUMBER(expression)

Returns number as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • False is 0.

  • True is 1.

  • Numbers are themselves.

  • Strings that parse as numbers are those numbers.

  • All other values are NULL.

TOOBJECT(expression)

Returns object as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • Objects are themselves.

  • All other values are the empty object.

TOSTRING(expression)

Returns string as follows:

  • MISSING is MISSING.

  • NULL is NULL.

  • False is "false".

  • True is "true".

  • Numbers are their string representation.

  • Strings are themselves.

  • All other values are NULL.