ref: 780d55cb042d7d8e892b25c1368355e0358b1969
dir: /cmd/6to5/main.go/
// Conversion of ES6+ into ES5.1 (wip) // // TODO: turn into a script that uses devjs package main import ( "fmt" "github.com/jvatic/goja-babel" "io" "log" "os" ) func Main() (err error) { babel.Init(1) // Setup 1 transformer (can be any number > 0) r, err := babel.Transform(os.Stdin, map[string]interface{}{ "plugins": []string{ "transform-block-scoping", "transform-destructuring", "transform-spread", "transform-parameters", }, }) if err != nil { return fmt.Errorf("transform: %v", err) } _, err = io.Copy(os.Stdout, r) return } func main() { if err := Main(); err != nil { log.Fatalf("%v",err) } }