# Path: scrapers/js2py/translators/friendly_nodes.py
# REGEXP_CONVERTER = PyJsParser()
# 
# Path: scrapers/js2py/prototypes/jsarray.py
# def to_arr(this):
#     def toString():
#             def func():
#     def toLocaleString():
#     def concat():
#     def join(separator):
#     def pop(): #todo check
#     def push(item): # todo check
#     def reverse():
#     def shift():  #todo check
#     def slice(start, end): # todo check
#     def sort(cmpfn):
#     def splice(start, deleteCount):
#     def unshift():
#     def indexOf(searchElement):
#     def lastIndexOf(searchElement):
#     def every(callbackfn):
#     def some(callbackfn):
#     def forEach(callbackfn):
#     def map(callbackfn):
#     def filter(callbackfn):
#     def reduce(callbackfn):
#     def reduceRight(callbackfn):
# def sort_compare(a, b, comp):
# ARR_STACK = set({})
#         A = this.Js([])
#         A = this.Js([])
#             E = items.pop(0)
#             E = items.pop(0)
#         T = arguments[1]
#         T = arguments[1]
#         T = arguments[1]
#         T = arguments[1]
#         A = this.Js([])
#         T = arguments[1]
# class ArrayPrototype:


from copy import copy
from .translators.friendly_nodes import REGEXP_CONVERTER
from .utils.injector import fix_js_args
from types import FunctionType, ModuleType, GeneratorType, BuiltinFunctionType, MethodType, BuiltinMethodType
from .prototypes import jsfunction, jsobject, jsnumber, jsstring, jsboolean, jsarray, jsregexp, jserror
import re
import traceback
import six
    import code
        return other.has_instance(self)
        
    #iteration
    def __iter__(self):
        #Returns a generator of all own enumerable properties
        # since the size od self.own can change we need to use different method of iteration.
        # SLOW! New items will NOT show up.
        returned = {}
        if not self.IS_CHILD_SCOPE:
            cands = sorted(name for name in self.own if self.own[name]['enumerable'])
        else:
            cands = sorted(name for name in self.own)
        for cand in cands:
            check = self.own.get(cand)
            if check and check['enumerable']:
                yield Js(cand)

    
    def contains(self, other):
        if not self.is_object():
            raise MakeError('TypeError',"You can\'t use 'in' operator to search in non-objects")
        return Js(self.has_property(other.to_string().value))
        
    #Other Special methods
    def __call__(self, *args):
        '''Call a property prop as a function (this will be global object).
        
        NOTE: dont pass this and arguments here, these will be added
        automatically!'''
        if not self.is_callable():

# Path: scrapers/js2py/translators/friendly_nodes.py
# REGEXP_CONVERTER = PyJsParser()
# 
# Path: scrapers/js2py/prototypes/jsarray.py
# def to_arr(this):
#     def toString():
#             def func():
#     def toLocaleString():
#     def concat():
#     def join(separator):
#     def pop(): #todo check
#     def push(item): # todo check
#     def reverse():
#     def shift():  #todo check
#     def slice(start, end): # todo check
#     def sort(cmpfn):
#     def splice(start, deleteCount):
#     def unshift():
#     def indexOf(searchElement):
#     def lastIndexOf(searchElement):
#     def every(callbackfn):
#     def some(callbackfn):
#     def forEach(callbackfn):
#     def map(callbackfn):
#     def filter(callbackfn):
#     def reduce(callbackfn):
#     def reduceRight(callbackfn):
# def sort_compare(a, b, comp):
# ARR_STACK = set({})
#         A = this.Js([])
#         A = this.Js([])
#             E = items.pop(0)
#             E = items.pop(0)
#         T = arguments[1]
#         T = arguments[1]
#         T = arguments[1]
#         T = arguments[1]
#         A = this.Js([])
#         T = arguments[1]
# class ArrayPrototype:


# Path: scrapers/js2py/base.py
from copy import copy
from .translators.friendly_nodes import REGEXP_CONVERTER
from .utils.injector import fix_js_args
from types import FunctionType, ModuleType, GeneratorType, BuiltinFunctionType, MethodType, BuiltinMethodType
from .prototypes import jsfunction, jsobject, jsnumber, jsstring, jsboolean, jsarray, jsregexp, jserror
import re
import traceback
import six
    import code

        return other.has_instance(self)
        
    #iteration
    def __iter__(self):
        #Returns a generator of all own enumerable properties
        # since the size od self.own can change we need to use different method of iteration.
        # SLOW! New items will NOT show up.
        returned = {}
        if not self.IS_CHILD_SCOPE:
            cands = sorted(name for name in self.own if self.own[name]['enumerable'])
        else:
            cands = sorted(name for name in self.own)
        for cand in cands:
            check = self.own.get(cand)
            if check and check['enumerable']:
                yield Js(cand)

    
    def contains(self, other):
        if not self.is_object():
            raise MakeError('TypeError',"You can\'t use 'in' operator to search in non-objects")
        return Js(self.has_property(other.to_string().value))
        
    #Other Special methods
    def __call__(self, *args):
        '''Call a property prop as a function (this will be global object).
        
        NOTE: dont pass this and arguments here, these will be added
        automatically!'''
        if not self.is_callable():

            raise  MakeError('TypeError', '%s is not a function'%self.typeof())