Nightly Perpetrated Mischief

    el-nunjucks

    1.0.0 • Public • Published

    el-nunjucks

    Build Status

    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.

    Install

    npm i el-nunjucks

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • odino