CoffeeScript

Besoin

Permettre un déploiement ce code Javascript avec une syntaxe

:

Analyse

Fonctionnalité CoffeeScript ES6
Lamba expressions square = (x) -> x * x var square = (x) => { x * x };
Arguments par défaut
fill = (container, liquid = "coffee") -> "Filling the #{container} with #{liquid}..."
var fill = (container, liquid = "coffee") => {
  "Filling the #{container} with #{liquid}..."
};
Limitation de portée des variables outer = 1 let outer = 1;
Varargs
awardMedals = (first, second, others...) -> gold = first silver = second rest = others
awardMedals (first, second, ...others);
Classe
class Animal constructor: (@name) ->
class Animal constructor (name) => { }
Interpolation de chaînes author = "Wittgenstein" quote = "A picture is a fact. -- #{ author }" var author = "Wittgenstein"; var quote = "A picture is a fact. -- ${author}";
Source maps --map traceur --sourcemap

Conception

Le code CoffeeScript est compilé en Javascript avant exécution.

Notes