Utility
Functions to encode and decode or convert from a format to another one
decode Base64(string)
Base64 decode function
Name | Required | Type | Description |
---|---|---|---|
string |
Yes |
Text |
Base64 encoded data |
Text |
utility.decode Base64("aGVsbG8=") => "hello"
decode JSON(string)
JSON decode function. Convert string to object
Name | Required | Type | Description |
---|---|---|---|
string |
Yes |
Text |
Data as string |
Any |
utility.decode JSON("{\"name\":\"John\"}") => "{\"name\":\"John\"}"
encode Base64(data)
Base64 encode function
Name | Required | Type | Description |
---|---|---|---|
data |
Yes |
Text |
Object |
Text |
utility.encode Base64("hello") => "aGVsbG8="
encode JSON(data)
JSON encode function. Convert Object/JSON to string
Name | Required | Type | Description |
---|---|---|---|
data |
Yes |
Any |
String |
Text |
utility.encode JSON({"name":"John"}) => "\"{\"name\":\"John\"}\""
from epoch(timestamp)
Epoch function convert timestamp to date and time, timestamp is expressed in milliseconds and date and time is set to UTC
Name | Required | Type | Description |
---|---|---|---|
timestamp |
Yes |
Number |
Timestamp expressed in milliseconds |
Date and time |
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
Name | Required | Type | Description |
---|---|---|---|
dateTime |
Yes |
Date and time |
Date and time |
Number |
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
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 |
Text |
utility.uri("https", "www.trisotech.com", ["path1", "path2"]) => "https://www.trisotech.com/path1/path2"
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"