Utility

Functions to encode and decode or convert from a format to another one

decode Base64(string, [encoding])

Base64 decode (both classic and URL encoding flavors) considering an optional character set encoding (defaults to UTF-8)

Parameters
Name Required Type Description

string

Yes

Text

Base64 encoded data

encoding

No

Text

Encoding Character Set ('UTF-8', 'ISO_8859_1', …​)

Returns

Text

Examples
utility.decode Base64("aGVsbG8=") => "hello"

decode JSON(string)

JSON decode function. Convert string to object

Parameters
Name Required Type Description

string

Yes

Text

Data as string

Returns

Any

Examples
utility.decode JSON("{\"name\":\"John\"}") => "{\"name\":\"John\"}"

encode Base64(data, [encoding])

Encode the data parameter using the Base64 encoding and the optional character encoding (defaults to UTF-8)

Parameters
Name Required Type Description

data

Yes

Text

Object

encoding

No

Text

Encoding Character Set ('UTF-8', 'ISO_8859_1', …​)

Returns

Text

Examples
utility.encode Base64("hello") => "aGVsbG8="

encode Base64URL(data, [encoding])

Encode the data parameter using the Base64 URL encoding and the optional character encoding (defaults to UTF-8)

Parameters
Name Required Type Description

data

Yes

Text

Object

encoding

No

Text

Encoding Character Set ('UTF-8', 'ISO_8859_1', …​)

Returns

Text

Examples
utility.encode Base64URL("hello") => "aGVsbG8="

encode JSON(data)

JSON encode function. Convert Object/JSON to string

Parameters
Name Required Type Description

data

Yes

Any

String

Returns

Text

Examples
utility.encode JSON({"name":"John"}) => "\"{\"name\":\"John\"}\""

filter null values(obj)

Remove null values from collections and context entries with null values recursively. Supports Any input type.

Parameters
Name Required Type Description

obj

Yes

Any

remove nulls from this

Returns

Any

Examples
utility.filter null values("{\"name\":\"John\", \"value\": null}") => "{\"name\":\"John\"}"

utility.filter null values([1, null, 2]) => "[1, 2]"

from epoch(timestamp)

Epoch function convert timestamp to date and time, timestamp is expressed in milliseconds and date and time is set to UTC

Parameters
Name Required Type Description

timestamp

Yes

Number

Timestamp expressed in milliseconds

Returns

Date and time

Examples
utility.from epoch(1511567100000) => "2017-11-24T23:45:00+00:00"

to epoch(dateTime)

Epoch function convert date and time to timestamp, timestamp is expressed in milliseconds. If date and time is not localized, it will be set to UTC

Parameters
Name Required Type Description

dateTime

Yes

Date and time

Date and time

Returns

Number

Examples
utility.to epoch(date and time(2017-11-24, 23:45:00)) => "1511567100000"

uri(scheme, host, [path], [parameters], [fragment])

Returns a properly encoded URI based on the passed scheme, host, path, parameters and fragment

Parameters
Name Required Type Description

scheme

Yes

Text

Refers to a specification for assigning identifiers

host

Yes

Text

Address of the server

path

No

Text | Collection of Text

Path to the resource

parameters

No

Any

Context

fragment

No

Text

Fragment

Returns

Text

Examples
utility.uri("https", "www.trisotech.com") => "https://www.trisotech.com"

utility.uri("https", "www.trisotech.com", "/path", {k: "value"}, "frag") => "https://www.trisotech.com/path?k=value#frag"

utility.uri("https", "www.trisotech.com", ["path1", "path2"]) => "https://www.trisotech.com/path1/path2"