Skip to main content

Object functions

$keys()

Signature: $keys(object)

Returns an array containing the keys in the object. If the argument is an array of objects, then the array returned contains a de-duplicated list of all the keys in all of the objects.

$lookup()

Signature: $lookup(object, key)

Returns the value associated with key in object. If the first argument is an array of objects, then all of the objects in the array are searched, and the values associated with all occurrences of key are returned.

$merge()

Signature: $merge(array<object>)

Merges an array of objects into a single object containing all the key/value pairs from each of the objects in the input array. If any of the input objects contain the same key, then the returned object will contain the value of the last one in the array. It is an error if the input array contains an item that is not an object.

$error()

Signature:$error(message)

Deliberately throws an error with an optional message

$assert()

Signature:$assert(condition, message)

If condition is true, the function returns undefined. If the condition is false, an exception is thrown with the message as the message of the exception.

$type()

Signature:$type(value)

Evaluates the type of value and returns one of the following strings:

  • "null"
  • "number"
  • "string"
  • "boolean"
  • "array"
  • "object"
  • "function" Returns (non-string) undefined when value is undefined.