milu

The two-way function tree

Usage no npm install needed!

<script type="module">
  import milu from 'https://cdn.skypack.dev/milu';
</script>

README

milu

build status

“麋鹿”

Install

npm install milu

Usage

var milu = require('milu');

var verb = {
  is: function (type) {
    return function *(next) {
      if (this.type === type) {
        yield next;
      }
    };
  },
  say: function (word) {
    return function *(next) {
      console.log(word);
    };
  },
};

var root = milu(verb);

root.is('cat').then
    .say('miao')
    .end
  .is('dog').then
    .say('wang')
    .end;

root.run({ type: 'cat' }, function (err) {
  // ...
});

LICENSE

MIT