def compile_js( script, module_path, main_name='main', directjs=False, directloops=False ):
	'''
	directjs = False     ## compatible with pythonjs-minimal.js
	directloops = False  ## allows for looping over strings, arrays, hmtlElements, etc. if true outputs cleaner code.
	'''
	fastjs = True  ## this is now the default, and complete python mode is deprecated
	result = {}

	pyjs = python_to_pythonjs(
		script,
		module_path=module_path,
		fast_javascript = fastjs,
		pure_javascript = directjs
	)

	if isinstance(pyjs, dict):  ## split apart by webworkers
		workers = []
		mainjs = None
		for jsfile in pyjs:
			js = translate_to_javascript(
				pyjs[jsfile],
				webworker=jsfile == 'worker.js',
				requirejs=False,
				insert_runtime=False,
				fast_javascript = fastjs,
				fast_loops      = directloops,
				runtime_checks  = '--release' not in sys.argv
			)
			result[ jsfile ] = js
			if jsfile == 'worker.js':
				workers.append(js)
			else:
				mainjs = jsfile

		src = [ 'var __workersrc__ = [' ]
		a = JS_WEBWORKER_HEADER.encode('utf-8') + workers[0]
		for line in a.strip().splitlines():
			src.append(	'"%s\\n",' % line.replace('"', '\\"'))
		src.append(']')
		src.append(result[mainjs])
		result[mainjs] = '\n'.join(src)

	else:

		code = translate_to_javascript(
			pyjs,
			as_module=sys.argv in '--ES6-module',
			requirejs=False,
			insert_runtime=False,
			fast_javascript = fastjs,
			fast_loops      = directloops,
			runtime_checks  = '--release' not in sys.argv
		)
		if isinstance(code, dict):
			result.update( code )
		else:
			result['main'] = code

	if main_name != 'main':
		#assert main_name.endswith('.js')  ## allow tag names
		result[main_name] = result.pop('main')

	return result
dataset/ETHPy150Open rusthon/Rusthon/rusthon.py/compile_js/swapped operands of `in`