timothycrosley / jiphy

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

Variable args not converted properly #27

Open mikaelho opened 6 years ago

mikaelho commented 6 years ago

Python function *args should convert to JS ...args.

jwest75674 commented 5 years ago

This is a bit old, but this issue appears when using jiphy for JS to Python conversion as well. For anyone else who runs into this issue, I found a quick workaround: Add an extra set of escaped brackets around the arguments (but within the parenthesis) via regex immediately prior to jiphy conversion.

E.g. function myFunctionName(arg1, arg2){ --> function myFunctionName((arg1, arg2)){

regex: find: /function ([a-zA-z]+)((.*?))/ replace: /function $1(\($2\))/