Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tower-expression with all npm packages installed. Try it out:

var towerExpression = require("tower-expression")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tower-expression v0.1.3

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 'apos; + 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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free