./redteamer

Functions

Data Type Functions

Functions for the idfentification and conversion of value types.


Type Conversion

These functions convert their arguments to specific types.

tobool

The tobool function converts its argument into a boolean value.

tobool(true)
# Result: true

tobool("true")
# Result: true

tobool(null)
# Result: null

tobool("no")
# Error: Invalid function argument - cannot convert "no" to bool

tobool(1)
# Error: Invalid function argument - cannot convert number to bool

tolist

The tolist function converts its argument into a list value.

tolist(["a", "b", "c"])
# Result: ["a", "b", "c"]

tolist(["a", "b", 3])
# Result: ["a", "b", "3"]

tomap

The tomap function converts its argument into a map value.

tomap({"a" = 1, "b" = 2})
# Result: {"a" = 1, "b" = 2}

tomap({"a" = "foo", "b" = true})
# Result: {"a" = "foo", "b" = "true"}

tonumber

The tonumber function converts its argument into a number value.

tonumber(1)
# Result: 1

tonumber("1")
# Result: 1

tonumber(null)
# Result: null

tonumber("no")
# Error: Invalid function argument - cannot convert "no" to number

toset

The toset function converts its argument into a set value.

toset(["a", "b", "c"])
# Result: ["a", "b", "c"]

toset(["a", "b", 3])
# Result: ["3", "a", "b"]

toset(["c", "b", "b"])
# Result: ["b", "c"]

tostring

The tostring function converts its argument into a string value.

tostring("hello")
# Result: "hello"

tostring(1)
# Result: "1"

tostring(true)
# Result: "true"

tostring(null)
# Result: "null"

tostring([])
# Error: Invalid function argument - cannot convert tuple to string

Type Identification

This function returns the type of a given value.

type

The type function returns the type of a provided value.

type("hello")
# Result: string

type(1)
# Result: number

type(true)
# Result: bool

type(null)
# Result: null

type(["a", "b", "c"])
# Result: list

type({"a" = 1, "b" = 2})
# Result: map
Previous
Crypto Functions