Support Transformers

Support transformers can be used on any data type. Following transformers are available:

isString

Outputs true or falseon whether the source String.

  • Usage: .isString()

  • Example usage: value.isString()

  • Example return: "bob" to true

isArray

Outputs true or falseon whether the source is Array.

  • Usage: .isArray()

  • Example usage: value.isArray()

  • Example return: ["bob", "man"] to true

isDictionary

Outputs true or falseon whether the source is Dictionary.

  • Usage: .isDictionary()

  • Example usage: value.isDictionary()

  • Example return: ["age": 21] to true

isNumber

Outputs true or falseon whether the source is Number.

  • Usage: .isNumber()

  • Example usage: value.isNumber()

  • Example return: 69420 to true

isBool

Outputs true or falseon whether the source is Bool.

  • Usage: .isBool()

  • Example usage: value.isBool()

  • Example return: false to true

toString

Describes values that otherwise throw an error when used in substitutions. For example, a dictionary can't be printed by {{ dict }}, however, it can be printed using {{ dict.toString() }}. This method fully describes Dictionary, Array, String, Number or Bool.

  • Usage: .toString()

  • Example usage: value.toString()

  • Example return: ["age": 21] to "["age": 21]"

toJSON

Describes values that otherwise throw an error when used in substitutions. For example, a dictionary can't be printed by {{ dict }}, however, it can be printed using {{ dict.toString() }}. This method fully describes Dictionary, Array, String, Number or Bool. The difference between toString and toJSON is most notable when describing Dictionary and Array, and usually results in a better description or one that can be used when JSON output is needed.

  • Usage: .toJSON()

  • Example usage: value.toJSON()

  • Example return: ["age": 21] to "{"age": 21}"