tower-directive-expression

0.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i tower-directive-expression

Weekly Downloads

0

Version

0.0.4

License

none

Last publish

Collaborators

  • viatropos