timothycrosley / jiphy

Your client side done in a jiphy. Python to JavaScript 2-way converter.
MIT License
585 stars 73 forks source link

Some errors in Python-to-JavaScript translation #31

Open jarble opened 5 years ago

jarble commented 5 years ago

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) {

    }
}