el-nunjucks
v1.0.0
Published
[![Build Status](https://travis-ci.org/odino/el-nunjucks.svg?branch=master)](https://travis-ci.org/odino/el-nunjucks)
Downloads
1
Maintainers
Readme
el-nunjucks
An expression language built on top of Mozilla's nunjucks template engine.
Installation
yarn add el-nunjucks
Usage
const el = require('el-nunjucks')
let ctx = {
a: 1,
b: () => 1,
c: {
d: 1
}
}
el.evaluate('1 + 1', ctx) // 2
el.evaluate('1 === 1', ctx) // true
el.evaluate('a + b()', ctx) // 2
el.evaluate('a + b() + c.d', ctx) // 3
el.evaluate('a + b() + c.d === 3', ctx) // true
Tests
npm test
Background
See this blog post for more info.