js: namespace

JavaScript classes and functions

The js built-in provides access to a number of JavaScript classes and utility functions that you may find useful to call directly in Origami expressions:

For example, if you want to explicitly cast a value to a string in an Origami expression, you can write:

text = String(value)

See also node, which provides access to a number of Node.js modules.

fetch(url, options)

The js:fetch() function wraps the basic fetch API so that it returns an ArrayBuffer. This can be fed directly to Origami functions that accept files.

See also post.

Instantiating JavaScript classes

To instantiate a class like Date, use the new: protocol.