1.0.1 • Published 7 years ago
ember-botanist v1.0.1
ember-botanist
This addon is a thin wrapper over the Botanist library.
Installation
yarn add [--dev] ember-botanist
Usage
See the Botanist README for more details on usage.
import { transform, rule, simple } from 'botanist';
let doMath = transform({
@rule({ op: 'add', lhs: simple('left'), rhs: simple('right') })
add({ left, right }) {
return left + right;
},
@rule({ op: 'sub', lhs: simple('left'), rhs: simple('right') })
subtract({ left, right }) {
return left - right;
}
});
doMath({ op: 'add', lhs: 1, rhs: 2 });
// => 3
doMath({ op: 'sub', lhs: { op: 'add', lhs: 2, rhs: 2 }, rhs: 1 });
// => 3