The Origami language includes a number of functions that you can call from Origami site definitions, Origami templates, and command-line interface commands.
Namespaces and protocols
- dev: Develop and debug Origami projects
- explore: URL protocol to treat a website with JSON keys as a tree
- files: URL protocol for file system folders and files
- help: Get help on builtin namespaces and commands
- http: URL protocol for web resources via HTTP
- https: URL protocol for web resources via HTTPS
- httpstree: URL protocol for a website tree via HTTPS
- httptree: URL protocol for a website tree via HTTP
- image: Format and resize images
- inherited: URL protocol to get an inherited value instead of a local one
- js: JavaScript classes and functions
- new: Create instances of JavaScript classes
- node: Node.js classes and modules
- origami: Perform general Origami language functions
- package: URL protocol for packages installed in node_modules
- scope: URL protocol to explicitly reference a key in scope
- site: Add common website features
- text: Manipulate text
- tree: Work with trees
Functions and objects by name
tree:
addNextPrevious(tree)
Add next/previous fields to the tree’s values
js:
JavaScript Array class
tree:
assign(target, source)
Apply key/values from source to target
site:
audit(tree)
Identify broken internal links and references
origami:
basename(key)
Removes an extension from the key if present
js:
JavaScript BigInt class
js:
JavaScript Boolean class
dev:
breakpoint(a)
Break into the JavaScript debugger, then return a
node:
Node.js Buffer class
origami:
The set of installed builtin functions
tree:
cache(tree, [cache], [filter])
Caches values from the tree
dev:
changes(old, new)
Return a tree of changes
tree:
clear(tree)
Remove all values from the tree
tree:
concat(…objs)
Concatenate text and/or trees of text
origami:
The current project’s configuration
tree:
copy(source, target)
Copy the source tree to the target
site:
crawl(tree, base)
A tree of a site’s discoverable resources
js:
JavaScript Date class
dev:
debug(tree)
Add debug features to the tree
js:
JavaScript decodeURI function
js:
JavaScript decodeURIComponent function
tree:
deepMap(tree, options)
Map the keys and values of a deep tree
tree:
deepMerge(…trees)
Return a deeply-merged tree
tree:
deepReverse(tree)
Reverse order of keys at all levels of the tree
tree:
deepTake(tree, n)
The first n values from the deep tree
tree:
deepValues(tree)
The in-order leaf values of the tree
tree:
defineds(tree)
Only the defined values of the tree
text:
document(text, [data])
Create a document object with the text and data
js:
JavaScript encodeURI function
js:
JavaScript encodeURIComponent function
tree:
entries(tree)
The tree’s [key, value] pairs
js:
JavaScript Error class
dev:
explore()
Explore the current scope [when run in browser]
origami:
Helpers for working with file extensions
js:
JavaScript false constant
js:
JavaScript fetch function
tree:
first(tree)
The first value in the tree
tree:
forEach(tree, fn)
Apply fn to each (value, key)
image:
format(image, format, options)
Return the image in a different format
tree:
from(object, options)
Create a tree from an object
tree:
fromFn(fn, [keys])
A tree defined by a value function
tree:
globs(patterns)
A tree whose keys can include wildcard patterns
tree:
group(tree, fn)
A new tree with values grouped by the function
tree:
has(tree, key)
True if key exists in tree
text:
Tagged template literal for normalizing indentation
site:
index(tree)
A default index.html page for the tree
js:
JavaScript Infinity constant
text:
inline(text)
Inline Origami expressions found in the text
tree:
inners(tree)
The tree’s interior nodes
js:
JavaScript Intl object
tree:
isAsyncMutableTree(object)
True if object is an async mutable tree
tree:
isAsyncTree(object)
True if object is an async tree
js:
JavaScript isFinite function
js:
JavaScript isNaN function
tree:
isTraversable(object)
True if object is traversable
tree:
isTreelike(object)
True if object can be coerced to a tree
origami:
json(obj)
Render the object in JSON format
js:
JavaScript JSON object
site:
jsonKeys(tree)
Add .keys.json files to a tree
origami:
jsonParse(text)
Parse text as JSON
tree:
keys(tree)
The keys of the tree
tree:
length(tree)
The tree’s size (number of keys)
dev:
log(a, message)
Log message to the console and return a
tree:
map(tree, options)
Create a new tree by mapping keys and/or values
js:
JavaScript Map class
tree:
mapReduce(tree, valueFn, reduceFn)
Map values and reduce them
tree:
match(pattern, fn, [keys])
Matches simple patterns or regular expressions
js:
JavaScript Math object
text:
mdHtml(markdown)
Render the markdown as HTML
tree:
merge(…trees)
Return a new tree merging the given trees
js:
JavaScript NaN constant
origami:
A comparison function for natural sort order
js:
JavaScript null constant
js:
JavaScript Number class
js:
JavaScript Object class
origami:
once(fn)
Run the function only once, return the same result
origami:
ori(text)
Evaluate the text as an Origami expression
tree:
paginate(tree, [n])
Group the tree’s values into fixed-size sets
tree:
parent(tree)
The parent of the given tree node
js:
JavaScript parseFloat function
js:
JavaScript parseInt function
node:
Node.js path module
tree:
paths(tree)
Slash-separated paths for the tree’s values
tree:
plain(tree)
Render the tree as a plain JavaScript object
origami:
post(url, data)
POST the given data to the URL
node:
Node.js process object
origami:
The root folder for the current Origami project
site:
redirect(url, options)
Redirect to the given URL
origami:
regexMatch(text, regex)
Return matches of the regex in the text
js:
JavaScript RegExp class
tree:
remove(tree, key)
Remove the value for the key from tree
origami:
repeat(n, obj)
An array of n copies of the object
image:
resize(image, options)
Resize the image
tree:
reverse(tree)
Reverse the order of the tree’s keys
tree:
root(tree)
The root node of the given tree
site:
rss(feed)
Transforms a JSON Feed tree to RSS XML
dev:
serve(tree, port)
Start a web server for the tree
js:
JavaScript Set class
tree:
setDeep(target, source)
Applies the source tree to the target
origami:
shell(text)
Run the text as a shell command, return the output
tree:
shuffle(tree)
Shuffle the keys of the tree
site:
sitemap(tree)
Generate a sitemap for the tree
origami:
Helpers for working with trailing slashes
site:
slug(text)
A version of the text suitable for use in URLs
tree:
sort(tree, options)
A new tree with its keys sorted
site:
static(tree)
Define common static files for the tree
origami:
Returns the content of the standard input stream
origami:
string(obj)
Coerce a buffer or document to a string
js:
JavaScript String class
dev:
svg(tree, options)
Render a tree visually in SVG format
js:
JavaScript Symbol class
tree:
take(tree, n)
The first n values in the tree
origami:
toFunction(obj)
Coerce a tree or packed function definition to a function
tree:
traverse(tree, …keys)
Return the value at the path of keys
tree:
traverseOrThrow(tree, …keys)
Return the value at the path of keys or throw
tree:
traversePath(tree, path)
Traverse a slash-separated path
js:
JavaScript true constant
js:
JavaScript undefined constant
origami:
unpack(buffer)
Unpack the buffer into a usable form
node:
Node.js URL module
tree:
values(tree)
The tree’s values
origami:
version()
Return the version number of the Origami language
dev:
watch(tree, fn)
Reevaluate fn when tree changes
origami:
yaml(obj)
Render the object in YAML format
origami:
yamlParse(text)
Parse text as YAML