Convert Javascript 1.7+ to Javascript 1.6

Are there any converters or methods for converting Javascript 1.7 code with its new language features in Javascript 1.6?

What interests me most is iterator generators and the yield keyword. I use a script mechanism that I use only 1.6, but iterator generators will do much better code. Writing it by hand seems complicated.

I tried writing it to C #, decompiling using ILSpy, and transferring it to Javascript manually. But this damn mess.

I was looking for such a converter, but I didn’t find anything - perhaps due to the fact that in this case the search conditions are shared with irrelevant results.

+4
source share
1 answer

I think I have found a solution for you. Check out the Traceur. This is an ES6 transpiler, that is, it converts ES6 code (with all the things that come with ES6, such as generators, classes, modules, yield ), into ES5 code, which JS engines can interpret today.

Take a look here: https://github.com/google/traceur-compiler/

Language Features Page https://github.com/google/traceur-compiler/wiki/LanguageFeatures

Note that most of the materials Mozilla adds to JavaScript 1.7+ are standardized in the next revision 6 of the ECMAScript standard. The current version is version 5, which already contains some of these materials (for example, array iteration methods, object extensibility APIs).

+7
source

Source: https://habr.com/ru/post/1446647/


All Articles