jiphy icon indicating copy to clipboard operation
jiphy copied to clipboard

Some errors in Python-to-JavaScript translation

Open jarble opened this issue 5 years ago • 0 comments

I ran the Jiphy translator with an example from the README, but this code was not translated correctly:

import jiphy

print(jiphy.to.javascript('''
import underscore as _

def my_function(argument1, argument2):
    if argument1:
        del argument2
    elif argument2:
        print(argument2)

    if somevar is someothervar and x is not b:
		pass
'''))

The JavaScript output contains some syntax errors. and should be && here:

;
var _ = require('underscore');

function my_function(argument1, argument2) {
    if (argument1) {
        delete argument2;
    } else if (argument2) {
        console.log(argument2);
    }
    if (somevar is someothervar and x !== b) {


    }
}

jarble avatar Jul 03 '19 18:07 jarble