Js2Py icon indicating copy to clipboard operation
Js2Py copied to clipboard

Is there a plan to support arrow functions?

Open lanyuer opened this issue 2 years ago • 2 comments

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.'

lanyuer avatar Jul 24 '23 09:07 lanyuer

@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

wiwichips avatar Jul 25 '23 19:07 wiwichips

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

Hansimov avatar Dec 12 '23 11:12 Hansimov