babel-plugin-chr
Babel plugin that precompiles CHR.js source code.
Install
npm install babel-plugin-chr
Usage
Run:
babel --plugins chr script.js
Or add the plugin to your .babelrc
configuration:
Example
The plugin will compile the following code:
var CHR = var chr =
into:
var _Runtime = ;var chr = Store: History: Constraints: {} Replacements: ; chr = { chra = _RuntimeHelper; chrConstraints'a/0' = ; chrb = _RuntimeHelper; chrConstraints'b/0' = ; chrConstraints'a/0'0 = { var self = this; var ids = constraintid; if ids if _RuntimeHelper if selfHistory selfHistory; self; }; return chr;}chr;
It supports the normal CHR.js
syntax as specified here: fnogatz/CHR.js