Skip to content

Instantly share code, notes, and snippets.

@lmuntaner
Last active December 7, 2021 12:48
Show Gist options
  • Save lmuntaner/8b20c316e0500450af26fd18d5bd934b to your computer and use it in GitHub Desktop.
Save lmuntaner/8b20c316e0500450af26fd18d5bd934b to your computer and use it in GitHub Desktop.
NodeJS Competitor: RunJS πŸš€
#!/usr/bin/python3
import dukpy
import sys
set_timeout_function = 'function setTimeout() { return; };'
if __name__ == '__main__':
filename = sys.argv[1]
(name, extension) = filename.split('.')
with open(filename, 'rt') as f:
js_text = f.read()
# RUNTIME ENVIRONMENT
result = dukpy.evaljs(set_timeout_function + js_text)
# NO RUNTIME ENVIRONMENT
# result = dukpy.evaljs(js_text)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment