Proxy-based FSM-like DSLs for ES6
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
src
.gitignore
README.md
package.json

README.md

Proxies used here are recursive; upon property access they either keep their return value wrapped in a similar Proxy, or don't, based on certain conditions. From the perspective of an FSM each Proxy type could be seen as representing one state. The result: an FSM-based custom DSLs based on ES6 Proxy. This is similar to Tom van Cutsem's principle of Membranes.

Notes: must inject Observable

Esp. great for cleaning ng2 classes with methods like this:

load() {
  if (this.data) {
    return Promise.resolve(this.data);
  }
  return new Promise(resolve => {
    this.http.get('data/data.json').subscribe(res => {
      this.data = this.processData(res.json());
      resolve(this.data);
    });
  });
}

Testing:

npm i -g jasmine-node
npm test
jasmine-node spec/extern-proxy.spec.js