Types
Functions for inspecting, checking, and converting value types.
is_array
1-parameter signature
is_array(value)
is_array checks whether value is an array value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is array, otherwise false.
is_binary
1-parameter signature
is_binary(value)
is_binary checks whether value is a binary value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is binary, otherwise false.
is_bool
1-parameter signature
is_bool(value)
is_bool checks whether value is a boolean value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is boolean, otherwise false.
is_datetime
1-parameter signature
is_datetime(value)
is_datetime checks whether value is a date time value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is date time, otherwise false.
is_duration
1-parameter signature
is_duration(value)
is_duration tests whether a value has the Duration type.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanTrue when the value is a Duration; otherwise false.
is_float
1-parameter signature
is_float(value)
is_float checks whether value is a float value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is float, otherwise false.
is_int
1-parameter signature
is_int(value)
is_int checks whether value is a int value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is int, otherwise false.
is_list
1-parameter signature
is_list(value)
is_list checks whether value is a list value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is list, otherwise false.
is_map
1-parameter signature
is_map(value)
is_map checks whether value is a map value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is map, otherwise false.
is_nan
1-parameter signature
is_nan(value)
is_nan checks whether value is NaN.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is NaN, otherwise false.
is_none
1-parameter signature
is_none(value)
is_none checks whether value is a none value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is none, otherwise false.
is_object
1-parameter signature
is_object(value)
is_object checks whether value is an object value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is object, otherwise false.
is_string
1-parameter signature
is_string(value)
is_string checks whether value is a string value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanReturns true if value is string, otherwise false.
to_array
1-parameter signature
to_array(input)
to_array takes an input value of any type and convert it into an array value.
None is converted to an empty array
Boolean values, numbers and strings are converted to an array containing the original value as its single element
Arrays keep their original value
Objects / HTML nodes are converted to an array containing their attribute values as array elements.
- Parameters
inputAnyInput value of arbitrary type.
- Returns
Any[]An array value.
to_binary
1-parameter signature
to_binary(value)
ToBinary takes an input value of any type and converts it into a binary value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BinaryA binary value.
to_bool
1-parameter signature
to_bool(value)
to_bool takes an input value of any type and converts it into the appropriate boolean value.
None is converted to false
Numbers are converted to true, except for 0, which is converted to false
Strings are converted to true if they are non-empty, and to false otherwise
Dates are converted to true if they are not zero, and to false otherwise
Arrays are always converted to true (even if empty)
Objects / HtmlNodes / Binary are always converted to true
- Parameters
valueAnyInput value of arbitrary type.
- Returns
BooleanThe appropriate boolean value.
to_datetime
1-parameter signature
to_datetime(value)
to_datetime converts one native DateTime or RFC3339 value.
- Parameters
valueDateTime | StringA DateTime or RFC3339 string.
- Returns
DateTimeParsed DateTime.
2-parameter signature
to_datetime(value, unit)
to_datetime returns a native DateTime, parses an RFC3339 string, or converts
a numeric Unix epoch value when an explicit unit is provided.
- Parameters
valueDateTime | String | Int | FloatA DateTime, RFC3339 string, or numeric Unix epoch value.unitStringEpoch unit: s, ms, us, or ns. Aliases include sec, second, seconds, millisecond, milliseconds, µs, μs, microsecond, microseconds, nanosecond, and nanoseconds. Valid only for numeric values.
- Returns
DateTimeParsed DateTime.
to_duration
1-parameter signature
to_duration(value)
ToDuration converts a value using the language's broad Duration coercion rules.
Numeric values are interpreted as milliseconds; Duration strings, NONE,
Booleans, and supported list shapes are also accepted.
- Parameters
valueAnyA value coercible to Duration.
- Returns
DurationA native duration value.
to_float
1-parameter signature
to_float(value)
to_float takes an input value of any type and convert it into a float value.
None and false are converted to the value 0
true is converted to 1
Numbers keep their original value
Strings are converted to their numeric equivalent if the string contains a valid representation of a number.
String values that do not contain any valid representation of a number will be converted to the number 0.
An empty array is converted to 0, an array with one member is converted into the result of to_number() for its sole member.
An array with two or more members is converted to the number 0.
An object / HTML node is converted to the number 0.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
FloatA float value.
to_int
1-parameter signature
to_int(value)
to_int takes an input value of any type and convert it into an integer value.
None and false are converted to the value 0
true is converted to 1
Numbers keep their original value
Strings are converted to their numeric equivalent if the string contains a valid representation of a number.
String values that do not contain any valid representation of a number will be converted to the number 0.
An empty array is converted to 0, an array with one member is converted into the result of to_number() for its sole member.
An array with two or more members is converted to the number 0.
An object / HTML node is converted to the number 0.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
IntAn integer value.
to_number
1-parameter signature
to_number(value)
to_number takes an input value of any type and convert it into a number value.
None and false are converted to the zero float
true is converted to 1 float
Numbers keep their original value
Strings are converted to their numeric equivalent if the string contains a valid representation of a number.
String values that do not contain any valid representation of a number will be converted to the number 0.
An empty array is converted to 0, an array with one member is converted into the result of to_number() for its sole member.
An array with two or more members is converted to the number 0.
An object / HTML node is converted to the number 0.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
Int | FloatAn integer or float value.
to_object
1-parameter signature
to_object(value)
to_object converts the given value to an object.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
MapReturns the object representation of the given value.
to_string
1-parameter signature
to_string(value)
to_string takes an input value of any type and convert it into a string value.
- Parameters
valueAnyInput value of arbitrary type.
- Returns
StringString representation of a given value.