0.3.1 • Published 8 years ago

formulafoundry v0.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

FormulaFoundry

circleci

Formula language for Node.js and Browser. See docs for language syntax.

Install

npm install --save formulafoundry

Usage

  1. Require the compiler.

    var compiler = require('formulafoundry');

Then you need a data object and a context that supports a get function.

var data = { successText: "Works!", errorText: "Broken!" };
var context = { get: function(key) { return data[key]; } };

Use the compiler to generate a function.

var myFunction = compiler.compile('if(true, successText, errorText)');

Run the function passing back in the requirements by calling resolve().

var result = myFunction(context, myFunction.resolve())

Properties

The function includes properties:

The identifier:

myFunction.id

The abstract syntax tree:

myFunction.ast

The list of required functions:

myFunction.requires

The list of precedents:

myFunction.precedents
0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago