PiotrDabkowski / Js2Py

JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python🚀 Try it online:
http://piter.io/projects/js2py
MIT License
2.44k stars 257 forks source link

Is there a plan to support arrow functions? #313

Open lanyuer opened 1 year ago

lanyuer commented 1 year ago

Currently, I can only use execjs to run my JavaScript methods because they heavily rely on arrow functions. The error message from js2py states: 'JsException: SyntaxError: Line 524: ArrowFunction is not supported by ECMA 5.1.'

wiwichips commented 1 year ago

@lanyuer You might find PythonMonkey useful! It supports modern JavaScript syntax and WebAssembly!

$ pip install pythonmonkey
import pythonmonkey as pm
my_js_func = pm.eval(' (x) => x*x ')

print( my_js_func(5) ) # prints 25.0
Hansimov commented 8 months ago

@wiwichips PythonMonkey works like a charm! You save my life!