So, you need to transpile classes to ES5 for some reason, but you need to do it in the browser.
Could we use a gross regular expression to get that done? Yes.
Should we? No, but it's far too late for that now.
- Classes definitions (no inheritance)
- Constructors (allows
return
) - Static methods
- Getters / setters
import transpile from 'transpile-lite';
let es5Code = transpile(`
class Foo {
constructor(a, b) {
console.log(a, b)
}
static get properties() { return [1,2,3] }
render() {
return 'stuff'
}
}
`)
- Improve comment handling
- Support getter/setter pairs (via memoized descriptor?)
Apache 2.0.