Skip to content

RADON Type System

Pseudotypes

  • Any
  • Inner
  • Match
  • Same
  • Subscript
OP CodeNameDescription
0xFFFailA catch-all used for matching.
0x00IdentityChecks if the given argument matches the input RAD object both in type and value.

Fail

A catch-all used for matching.

Identity

Checks if the given argument matches the input RAD object both in type and value.

OP CodeTypeMethod NameMethod ParamsResponse
0x10RADArraycount()noneRADInteger
0x11RADArrayfilter(Subscript)SubscriptRADArray
0x13RADArraygetArrayindexRADArray
0x14RADArraygetBooleanindexRADBoolean
0x15RADArraygetBytesindexRADBytes
0x16RADArraygetFloatindexRADFloat
0x17RADArraygetIntegerindexRADInteger
0x18RADArraygetMapindexRADMap
0x19RADArraygetStringindexRADString
0x1ARADArraymapSubscriptRADArray
0x1BRADArrayreduceSubscriptRADAnyType
0x22RADBooleanasStringnoneRADString
0x22RADBooleannegatenoneRADBoolean
0x30RADBytesasStringnoneRADString
0x31RADByteshashnoneRADString
0x40RADIntegerabsolutenoneRADInteger
0x41RADIntegerasFloatnoneRADFloat
0x42RADIntegerasStringnoneRADString
0x43RADIntegergreaterThanvalueRADBoolean
0x44RADIntegerlessThanvalueRADBoolean
0x46RADIntegermodulovalueRADInteger
0x47RADIntegermultiplyvalueRADInteger
0x48RADIntegernegatenoneRADInteger
0x49RADIntegerpowervalueRADInteger
0x50RADFloatabsolutenoneRADFloat
0x51RADFloatasStringnoneRADString
0x52RADFloatceilingnoneRADInteger
0x53RADFloatgreaterThanvalueRADBoolean
0x54RADFloatfloornoneRADInteger
0x55RADFloatlessThanvalueRADBoolean
0x56RADFloatmodulovalueRADInteger
0x57RADFloatmultiplyvalueRADFloat
0x58RADFloatnegatenoneRADFloat
0x59RADFloatpowervalueRADFloat
0x5BRADFloatroundnoneRADInteger
0x5DRADFloattruncatevalueRADInteger
0x61RADMapgetArraykeyRADArray
0x62RADMapgetBooleankeyRADBoolean
0x63RADMapgetByteskeyRADBytes
0x64RADMapgetFloatkeyRADFloat
0x65RADMapgetIntegerkeyRADInteger
0x66RADMapgetMapkeyRADMap
0x67RADMapgetStringkeyRADString
0x68RADMapkeysnoneRADArray
0x69RADMapvaluesAsArraynoneRADArray
0x70RADStringasBooleannoneRADBoolean
0x72RADStringasFloatnoneRADFloat
0x73RADStringasIntegernoneRADInteger
0x74RADStringlengthnoneRADInteger
0x75RADStringmatchvalueRADBoolean
0x76RADStringparseJSONArrayvalueRADArray
0x77RADStringparseJSONMapvalueRADMap
0x78RADStringparseXMLMapvalueRADMap
0x79RADStringtoLowerCasenoneRADString
0x7ARADStringtoUpperCasenoneRADString

RADArray

RADArray.count()

The method count counts the number of elements in the input Array. There are no parameters.

RADArray.filter(Subscript)

The filter method discards the items in the input array that do not match the given filter subscript.

Example:

javascript
// Example Source data 
// {"data": [{"id": "one"},{"id": "two"},{"id": "three"}]}

// Retrieve a sublist from an array by applying a filter to each entry. 
Witnet.Source("https://...")
  .parseJSONMap()
  .getArray("data")
  .filter(
    new Witnet.Script([ Witnet.TYPES.MAP ])
      .getString("id")
      .match({ "one": true }, false )
  )
// Returns [{"id": "one"}]

RADArray.getArray(RADInteger)

The getArray method returns a RADArray object for the given index.

RADArray.getBoolean(RADInteger)

The getBoolean method returns a RADBoolean object for the given index.

RADArray.getBytes(RADInteger)

The getBytes method returns a RADBytes object for the given index.

RADArray.getFloat(RADInteger)

The getFloat method returns a RADFloat object for the given index.

RADArray.getInteger(RADInteger)

The getInteger method returns a RADInteger object for the given index.

RADArray.getMap(RADInteger)

The getMap method returns a RADMap structure for the given index.

RADArray.getString(RADInteger)

The getString method returns a RADBoolean object for the given index.

RADArray.map(Subscript)

The map method applies the given subscript on all the elements in the input Array.

RADArray.reduce(Subscript)

The reduce method reduces all the items in the input Array into a single item by applying a reducer function.

RADBoolean

RADBoolean.asString()

The asString method represents the input Boolean value as a string.

e.g. "True" or "False"

RADBoolean.negate()

The negate method reverses the input Boolean.

It returns "True" if the value is "False", and returns "False" if the value is "True".

RADBytes

RADBytes.asString()

The asString method returns the input Bytes as a hexadecimal String.

RADBytes.hash()

The hash method computes the SHA256 hash in the input Bytes.

RADInteger

RADInteger.absolute()

The absolute method Calculates the absolute value of the input Integer.

RADInteger.asFloat()

The asFloat method Returns the input Integer as a Float.

RADInteger.asString()

The asString method Returns the input Integer as a String.

RADInteger.greaterThan(RADInteger)

The greaterThan method Checks if the input Integer is greater than the given argument.

RADInteger.lessThan(RADInteger)

The lessThan method checks if the input Integer is less than the given argument.

RADInteger.modulo(RADInteger)

The modulo method calculates the integer division of the input Integer

RADInteger.multiply(RADInteger)

The multiply method multiplies the input Integer by the given factor.

RADInteger.negate()

The negate method calculates the negative of the input Integer.

RADInteger.power(RADInteger)

The power method calculates the input raise to the power of the given exponent.

RADFloat

RADFloat.absolute()

The absolute method computes the absolute value of the input Float.

RADFloat.asString()

The asString method returns the input Float as a String.

RADFloat.ceiling()

The ceiling method computes the lowest Integer value greater than or equal to the input Float.

RADFloat.greaterThan()

The greaterThan method compares if the input Float is greater than the provided input.

RADFloat.floor()

The floor method computes the greatest Integer less than or equal to the input Float.

RADFloat.lessThan()

The lessThan method compares if the input Float is less than the provided argument.

RADFloat.modulo()

The modulo method computes the division of the input Float.

RADFloat.multiply(RADFloat)

The multiply method multiplies the input Float by the given factor.

RADFloat.negate()

The negate method computes the negative of the input Float.

RADFloat.power()

The power method computes the input Float raised to the power of the provided exponent.

RADFloat.round()

The round method rounds the Integer part from the input Float.

RADFloat.truncate()

The truncate method takes the Integer part from the input Float.

RADMap

RADMap.getArray(RADString)

The getArray method returns an Array structure.

RADMap.getBoolean(RADString)

The getBoolean method returns a Boolean.

RADMap.getBytes(RADString)

The getBytes method returns an array of Bytes.

RADMap.getFloat(RADString)

The getFloat method returns a Float.

RADMap.getInteger(RADString)

The getInteger method returns an Integer

RADMap.getMap(RADString)

The getMap method returns a Map structure.

RADMap.getString(RADString)

The getString method returns a String.

RADMap.keys()

The keys method obtains a list with the key names of the input Map.

RADMap.valuesAsArray()

The valuesAsArray method obtains a list with the values of the input Map.

RADString

RADString.asBoolean()

The asBoolean method parses the input String as a Boolean value.

There are no method parameters and it returns a RADBoolean.

RADString.asFloat()

The asFloat method parses the input String as a Float value.

There are no method parameters.

RADString.asInteger()

The asInteger method parses the input String as an Integer value.

There are no method parameters.

RADString.length()

The length method counts the number of characters of the input String.

There are no method parameters.

RADString.match(RADString)

The match method matches the input String with the given subscript and returns a Boolean value.

Method Params:

String value

RADString.parseJSONArray(RADString)

The parseJSONArray method interprets the input String as a JSON-encoded Array.

Method Params:

String value The input value must be a valid JSON Array or it will return an JsonParse error.

RADString.parseJSONMap(RADString)

The parseJSONMap method interprets the input String as a JSON-encoded Map.

Method Params:

String value The input value must be a valid JSON-encoded Map or it will return a JsonParse error.

RADString.parseXMLMap(RADString)

The parseXMLMap method interprets the input String as an XML-encoded Map.

Method Params:

String value The input value must be a valid XML-encoded Map or it will return a JsonParse error.

RADString.toLowerCase()

The toLowerCase method converts the input String to lowercase.

RADString.toUpperCase()

The toUpperCase method converts the input String to uppercase.