language

0.4.0 • Public • Published

Language

language is a very small library for building DSLs in Javascript.

npm install language

Why?

Because magic scope! and because no globals!

var language = require('language');

var robot = language({
  position: {x: 0, y: 0},

  moveLeft: function() {
    this.position.x--;
  },

  moveRight: function() {
    this.position.x++;
  },

  moveUp: function() {
    this.position.y--;
  },

  moveDown: function() {
    this.position.y++;
  },
});

robot(function () {
  console.log(position);

  moveDown();
  console.log(position);

  moveRight();
  console.log(position);
});

How?

Read the source, it's small.

/language/

    Package Sidebar

    Install

    npm i language

    Weekly Downloads

    135

    Version

    0.4.0

    License

    BSD-2-Clause

    Last publish

    Collaborators

    • refractalize