JS2

Javascript Syntactic Sugar

JS2 is for anyone who writes Javascript whether it be for browsers or for serverside scripting (nodejs and ringojs). JS2 provides superset of javascript (which is backwards compatible with normal javascript) for features like: classes, inheritance, methods, currying, and shorthand sugar for common patterns.

Author

Jeff Su (me@jeffsu.com)

Try

Install

Browser

There are 2 ways to run js2 in the web browser. The first is to import js2 files and compile them on the client side web browsers, but this is slow and should only be used for testing. The second is to compile js2 on the server side and then run the raw javascript on the web browser.

Option 1 (easy): Download js2-full.js and include it in a script tag. Here is some sample code:
JS2.require("/javascripts/my-code.js2", function (code) { eval(code) });
Option 2 (preferred): Download js2.js and include it in a script tag. Just make sure you include it before any compiled js2 code.

NodeJS

npm install js2

RingoJS

ringo-admin install jeffsu/js2

Ruby

gem install js2 --pre

Docs

Source

Clone it with git by running

git clone git://github.com/jeffsu/js2

Download Project here: zip or tar