parameters: (module_name, include_polyfill=True, update=False, context=None)
return_statement: return context['var'][_get_module_var_name(module_name)].to_py()
docstring: Installs the provided npm module, exports a js bundle via browserify, converts to ECMA 5.1 via babel and
      finally translates the generated JS bundle to Python via Js2Py.
      Returns a pure python object that behaves like the installed module. Nice!
  
      :param module_name: Name of the npm module to require. For example 'esprima'. Supports specific versions via @
          specification. Eg: 'crypto-js@3.3'.
      :param include_polyfill: Whether the babel-polyfill should be included as part of the translation. May be needed
      for some modules that use unsupported features of JS6 such as Map or typed arrays.
      :param update: Whether to force update the translation. Otherwise uses a cached version if exists.
      :param context: Optional context in which the translated module should be executed in. If provided, the
          header (js2py imports) will be skipped as it is assumed that the context already has all the necessary imports.
      :return: The JsObjectWrapper containing the translated module object. Can be used like a standard python object.
docstring_summary: Installs the provided npm module, exports a js bundle via browserify, converts to ECMA 5.1 via babel and
      finally translates the generated JS bundle to Python via Js2Py.
      Returns a pure python object that behaves like the installed module. Nice!
docstring_tokens: Installs the provided npm module exports a js bundle via browserify converts to ECMA 5 . 1 via babel and finally translates the generated JS bundle to Python via Js2Py . Returns a pure python object that behaves like the installed module . Nice!
function: def require(module_name, include_polyfill=True, update=False, context=None):
      """
      Installs the provided npm module, exports a js bundle via browserify, converts to ECMA 5.1 via babel and
      finally translates the generated JS bundle to Python via Js2Py.
      Returns a pure python object that behaves like the installed module. Nice!
  
      :param module_name: Name of the npm module to require. For example 'esprima'. Supports specific versions via @
          specification. Eg: 'crypto-js@3.3'.
      :param include_polyfill: Whether the babel-polyfill should be included as part of the translation. May be needed
      for some modules that use unsupported features of JS6 such as Map or typed arrays.
      :param update: Whether to force update the translation. Otherwise uses a cached version if exists.
      :param context: Optional context in which the translated module should be executed in. If provided, the
          header (js2py imports) will be skipped as it is assumed that the context already has all the necessary imports.
      :return: The JsObjectWrapper containing the translated module object. Can be used like a standard python object.
      """
      module_name, maybe_version = (module_name+"@@@").split('@')[:2]
  
      py_code = _get_and_translate_npm_module(module_name, include_polyfill=include_polyfill, update=update,
                                              maybe_version_str=maybe_version)
      # this is a bit hacky but we need to strip the default header from the generated code...
      if context is not None:
          if not py_code.startswith(DEFAULT_HEADER):
              # new header version? retranslate...
              assert not update, "Unexpected header."
              py_code = _get_and_translate_npm_module(module_name, include_polyfill=include_polyfill, update=True)
              assert py_code.startswith(DEFAULT_HEADER), "Unexpected header."
          py_code = py_code[len(DEFAULT_HEADER):]
      context = {} if context is None else context
      exec(py_code, context)
      return context['var'][_get_module_var_name(module_name)].to_py()
function_tokens: def require ( module_name , include_polyfill = True , update = False , context = None ) : module_name , maybe_version = ( module_name + "@@@" ) . split ( '@' ) [ : 2 ] py_code = _get_and_translate_npm_module ( module_name , include_polyfill = include_polyfill , update = update , maybe_version_str = maybe_version ) # this is a bit hacky but we need to strip the default header from the generated code... if context is not None : if not py_code . startswith ( DEFAULT_HEADER ) : # new header version? retranslate... assert not update , "Unexpected header." py_code = _get_and_translate_npm_module ( module_name , include_polyfill = include_polyfill , update = True ) assert py_code . startswith ( DEFAULT_HEADER ) , "Unexpected header." py_code = py_code [ len ( DEFAULT_HEADER ) : ] context = { } if context is None else context exec ( py_code , context ) return context [ 'var' ] [ _get_module_var_name ( module_name ) ] . to_py ( )