Skip to content

Conversation

@worstperson
Copy link
Collaborator

This seems to work with all my tests, but does not follow spec. Has the properties of a function rather than an Arrow function.

The code I want to run looks something like this:

import js2py
context = js2py.EvalJs()

def String_prototype_includes(searchString, position = 0):
    this.cok()
    S = this.to_string().value
    searchStr = searchString.to_string().value
    pos = position.to_int()
    if S[pos:pos+len(S)].find(searchStr.lower()) != -1:
        return this.Js(True)
    return this.Js(False)
context.String.prototype.includes = String_prototype_includes

context.execute(r'''
const words = 'dead|beef'.split('|');
var sentence = ' This is a test'
let containsWord = words.some(word => sentence.toLowerCase().includes(word));
''')

This seems to work with all my tests, and the code I want to run, but does not follow spec. Has the properties of a function rather than an Arrow function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant