tower-directive-expression

## Installation

npm install tower-directive-expression
9 downloads in the last month

Directive Expression Compiler

Installation

node.js:

npm install tower-directive-expression

browser:

component install tower/directive-expression

Example

var compile = require('tower-directive-expression');
var exp = compile('data-text', 'post[attr.name]');
console.log(exp.edges); // attribute chains to watch

Watching content for changes.

var content = require('tower-content');
var scope = content('page').init({ title: 'foo' });
var el = document.querySelector('#title');

exp.watch(scope, function(){
  el.textContent = exp.fn(scope);
});

Notes

filter-expression: exp1 | filter1:exp2 | filtern: expn
iterator-expression: exp1 for name in exp2
iterator-expression: exp1 group by exp2 for name in exp3
hash-expression: key1: exp1, key2: exp2, ..., key2: expn
hash-expression: key1: string + {{exp1}} + ... + {{expn}}
expression: string + {{exp1}} + ... + {{expn}}

Licence

MIT

npm loves you