1. Instead of implementing it in vanilla JavaScript, consider creating a Sweet.js macros (or series of macros), so it can be used with other flavors of JS as well (e.g. JSX, etc)
2. On the async functions – what happens if you put an async function inside a conditional? This is effectively solved by ES6's yield + co or an equivalent.
3. A nitpick, but, is there a way to create static functions on classes? E.g. Car.x instead of Car.prototype.x?
Looks like the readme example doesn't work. I didn't compile the djs sayHello function to verify it matches the given javascript, but running sayHello("nyc") spits out
Hello to undefined, nyc
You didn't tell me your age
By the way, `typeof X === 'undefined'` doesn't need to be used for variable names that exist such as arguments, you can use X == undefined without opportunity for failure.
Technically, all edge cases considered, `typeof` is the only fool-proof check, since you can't override the string constant `'undefined'` but the `undefined` identifier is fair game.
Here is one such edge case:
(function () {
var undefined = true;
return (function foo(x) {
return x === undefined;
}());
}()); // false
Language pedantry aside, browsers these days will freeze `window.undefined` so you'd have to shoot yourself in your own scope ;)
2. On the async functions – what happens if you put an async function inside a conditional? This is effectively solved by ES6's yield + co or an equivalent.
3. A nitpick, but, is there a way to create static functions on classes? E.g. Car.x instead of Car.prototype.x?