Namibian Pyjama Merchant
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

tower-expression

0.1.3 • Public • Published

Tower Expression

Installation

node.js:

$ npm install tower-expression

browser:

$ component install tower/expression

Examples

var expression = require('tower-expression');

Simple expression:

var fn = expression('1 + 1');
fn();

Expression evaluated against scope:

var scopes = require('tower-scope');
 
// define some scope attributes used in the DOM.
scopes('dashboard')
  .attr('profit', 'float', 0.0);
 
// instantiate the scope
var scope = scopes('dashboard').init({ profit: 1000000 });
 
// define a `currency` filter
var filter = require('tower-filter');
filter('currency', function(val){
  return '$' + val + '.00';
});
 
// define an expression
// (this automatically gets generated from dom directives)
var fn = expression('profit | currency');
fn(scope); // $1,000,000.00

Licence

MIT

Keywords

none

install

npm i tower-expression

Downloadsweekly downloads

4

version

0.1.3

license

none

repository

githubgithub

last publish

collaborators

  • avatar