From 5bc69cce8d7abe1d166d2defef43290815ed9283 Mon Sep 17 00:00:00 2001 From: milahu Date: Thu, 22 Jun 2023 15:24:21 +0200 Subject: [PATCH] add example code: Translating multiple JavaScript files --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index dc72d685..fb66a31e 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,17 @@ Translating a JavaScript file: >>> example.someFunction() ... ``` + +Translating multiple JavaScript files: + +```python +import js2py +import pathlib +for js_path in pathlib.Path(".").rglob("*.js"): + py_path = js_path.with_suffix(".py") + print(f"translating {js_path}") + js2py.translate_file(js_path, py_path) +``` Every feature of ECMA 5.1 is implemented (except of 'with' statement):