balena temen
A templating engine for JSON.
Provides facilities to:
- evaluate JSON
- evaluate JSON with custom evaluation keyword, functions and filters
- evaluate single expression (result is of any type)
- evaluate single logical expression (result is a boolean)
- retrieve AST of any expression / identifier
Goal
balena-temen
crate is one small piece of the balena.io configuration project. This project has
no public / open specification yet, but we're working on it and it will be public once finished.
Supported platforms
This library is written in the Rust language and can be used:
- directly, as a Rust crate
- as an isomorphic NPM package (NodeJS & browser)
Documentation
Usage
Rust
Add as a dependency to your Cargo.toml
:
[dependencies]
balena-temen = "0.1"
Evaluate simple JSON:
use evaluate;
use json;
let data = json!;
let evaluated = json!;
assert_eq!;
Node
Add as a dependency to your package.json
:
Evaluate simple JSON:
const bt = require;
console.log;
Fully working example available in the examples/node
folder:
Browser
Add as a dependency to your package.json
:
Evaluate simple JSON:
import * as bt from "balena-temen";
console.log;
Fully working example available in the examples/browser
folder:
Open localhost:8080
in your browser and you should see evaluated JSON in the browser console.
Support
If you're having any problem, please raise an issue on GitHub or contact us, and the balena.io team will be happy to help.
License
balena-temen
is open source software, and may be redistributed under the terms specified in
the license.