kamicane / harmonizer Goto Github PK
View Code? Open in Web Editor NEWes6 transpiler
es6 transpiler
let y = x => x * 2;
var z = x => ++x;
Compiles to
var yA = function (xA) {
return xA * 2;
};
var z = function (x) {
return ++xA;
};
The local variable x
in function z
shouldn't be renamed.
var [x, ...xs] = [1, 2, 3];
should yield in var x = 1
and var xs = [2, 3]
.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=933276
given a source like
var ArrayLike = class extends Array {
constructor(...args){
if (args.length === 1 && typeof args[0] === 'Number') {
this.length = args[0]
}else{
this.push.apply(this, args)
}
}
}
var HaskellArray = class extends ArrayLike {
constructor(...args){
if(args.length === 1) {
super(0)
this.push(args[0])
}else{
super(...args)
}
}
head(){
return new HaskellArray(this[0])
}
tail(){
return new HaskellArray(...this.slice(1))
}
}
I get an error while transpiling, trying the same code on http://kamicane.github.io/harmonizer-demo/
on the es5 output (escodegen) I can read the error Unknown expression type: SpreadElement
on the tail method
Guessing it's not supported as of yet, but for funzies here's the stack trace (Node v0.10.28):
node_modules/harmonizer/node_modules/nodes/lib/factory.js:475
if (!NodeClass) throw new Error('missing type: ' + type);
^
Error: missing type: ImportDeclaration
at build (node_modules/nodes/lib/factory.js:475:25)
at Array.map (native)
at build (node_modules/harmonizer/node_modules/nodes/lib/factory.js:491:37)
at transform (node_modules/harmonizer/index.js:56:17)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.