ember-botanist

An Ember addon to provide the Botanist library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ember-botanist
001.0.17 years ago7 years agoMinified + gzip package size for ember-botanist in KB

Readme

ember-botanist Build Status
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