Mascara JavaScript Compiler

Take control of JavaScript

Mascara enhances JavaScript with powerful features like classes, namespaces, type-verification and a host of other improvements. It compiles the enhanced JavaScript into "object code", which will run in any browser today. Read more


Less pain: Mascara eliminates a host of subtle bugs and mistakes which otherwise can be frustrating and time consuming to locate and debug in ordinary JavaScript development.

Bigger picture: Higher level structures like packages, classes and interfaces, known from other modern languages, lets you create larger and richer applications without making a mess of the code.

Compatible: Mascara works together with plain JavaScript including third-party libraries like jQuery. Features like type inference, type-system support for prototype inheritance, and structural types allows you to gradually fix and elevate legacy code without having to rewrite everything from scratch.

Future standards today: The language enhancements are based on proposals for the next generation of JavaScript, known as Ecmascript 6/Harmony. In the future these feature will be supported natively by browsers, but Mascara allows you to take advantage of them today.

Tool support: Code completion, hints and code navigation based on the Mascara code analysis can boost your productivity.

Fun: Lots of little improvements make JavaScript development more productive and less frustrating.

See supported language features

A few examples of the improvements

window.loaction = newurl;
A trivial spelling error is detected and flagged by Mascara at typing-time. In traditional JavaScript development this bug might go undetected until the program show erroneous behavior at runtime, and it might be time consuming to locate the source of the bug.

The earlier a bug is flagged, the easier it is to fix

Do you like to write code like this:

    var x = 1;
Or would you prefer to write code like this:
    let x = 1;

Mascara takes the boilerplate-code out of Javascript, and lets you focus on the important stuff.

Classes and interfaces:

class Car implements Runnable {}
class Volvo extends Car {}
In addition to prototypal objects.

Support for named and optional parameters:

   function f(a, b=true) {}
   f(true, false)
   f(a=false, b=true)
In traditional JavaScript, all parameters are treated as optional.

Multiline regular expressions with whitespace and comments improves readability:

var ptn = /
   [a-zA-Z]  # letter
   \d{2,3}   # 2-3 digits

for-of loops iterates over the values in an array:

   for (var elem of elements) {
(Contrast with the regular for-in which iterates over the keys or indices in the array)

Allows a trailing comma in array and object literal

   var x = [
Without this, it is a common bug to omit or duplicate commas when adding, removing or rearranging items.

Se a more through overview of supported language features

How does it work?

Mascara is used at development time, typically hooked into the editor. It analyzes and verifies the enhanced JavaScript files, and generates an output file which can then be deployed to the web along with other assets. There is no runtime dependencies on the server or client. The warning and hints from the compiler helps you locate and fix bugs during development.

The (optional) Eclipse plugin supports Mascara directly in the editor, with hints, code completion etc.


Try it online | Download | Buy | Read the blog