JavaScript expression functions

SimWorkflow provides a small number of functions that can be used in JavaScript expression to help process the data.


Swf.hmacSha256Hex

Swf.hmacSha256Hex(key, data)

HmacSHA256 Message Authentication Code (MAC) for the given key String and data String.

Parameters:

Returns:


Swf.ipAddressMatches

Swf.ipAddressMatches(ipAddress, address)

Check the ipAddress matches another address.

Swf.ipAddressMatches("127.0.0.1/16", "127.0.0.1")   = true
Swf.ipAddressMatches("127.0.0.1/16", "192.168.0.1") = false

Parameters:

Returns:


Swf.base64Encode

Swf.base64Encode(dataToEncode)

Converts an ASCII string to a base 64 representation.

Swf.base64Encode("Data to encode") = "RGF0YSB0byBlbmNvZGU="

Parameters:

Returns:


Swf.base64Decode

Swf.base64Decode(dataToDecode)

Converts base 64 encoded representation to an ASCII string.

Swf.base64Decode("RGF0YSB0byBlbmNvZGU=") = "Data to encode"

Parameters:

Returns:


Swf.isNotBlank

Swf.isNotBlank(data)

Checks if a string data is not empty (""), not null and not whitespace only.

Swf.isNotBlank(null)      = false
Swf.isNotBlank("")        = false
Swf.isNotBlank(" ")       = false
Swf.isNotBlank("bob")     = true
Swf.isNotBlank("  bob  ") = true

Parameters:

Returns:


Swf.isBlank

Swf.isBlank(data)

Checks if a string data is empty (""), null, orwhitespace only.

Swf.isBlank(null)      = true
Swf.isBlank("")        = true
Swf.isBlank(" ")       = true
Swf.isBlank("bob")     = false
Swf.isBlank("  bob  ") = false

Parameters:

Returns:


Swf.isNotEmpty

Swf.isNotEmpty(data)

Checks if a string data is not empty ("") and not null.

Swf.isNotEmpty(null)      = false
Swf.isNotEmpty("")        = false
Swf.isNotEmpty(" ")       = true
Swf.isNotEmpty("bob")     = true
Swf.isNotEmpty("  bob  ") = true

Parameters:

Returns:


Swf.isEmpty

Swf.isEmpty(data)

Checks if a string data is empty ("") or null

Swf.isEmpty(null)      = true
Swf.isEmpty("")        = true
Swf.isEmpty(" ")       = false
Swf.isEmpty("bob")     = false
Swf.isEmpty("  bob  ") = false

Parameters:

Returns: