Repository navigation
0.3.1
Support for more JavaScript syntax
This release adds support for JS-style property access via the . operator, or computed property access via [ ] square brackets.
Because Origami allows . in identifiers, you can't directly append a property name to an object reference. If you want to get the name property from a package.json file, you can't write package.json.name, because that looks like a long file name.
Instead, you can now write these:
(package.json).name— Use a.immediately after a closing parenthesis. The property name after the.has to be a legal JavaScript identifier.pagkage.json .name— Put the.namereference after whitespace (JS allows this kind of whitespace before a property name too!)package.json["name"]— Use the string"name"in brackets
You can also use the previously-supported forms:
package.json/name— Origami/path syntaxpackage.json("name")— Treat the object as a function
You can use the . property operator directly after a literal: "hello".toUpperCase() returns "HELLO".
Square brackets can also be used for array access. If team.yaml exports an array, you can use any of the following to get the first element of the array:
team.yaml[0]team.yaml/0team.yaml(0)
async-tree map enhancements
Some features of the Origami tree:map builtin have been promoted to the underlying async-tree library so that they can be called directly from JavaScript:
- Support for the
extensionoption - The ability to pass just a
keyoption and have an appropriateinverseKeyfunction generated for you