6utt3rfly / jse-eval

Javascript Expression Evaluator
MIT License
22 stars 7 forks source link

Fix Binding #68

Closed 6utt3rfly closed 1 year ago

6utt3rfly commented 1 year ago

Use correct binding for member and function calls

Tests:

"abc".slice(1) === "bc"
{ foo: 'bar', test: function() { return this.foo } }.test() === 'bar'

Before this PR, the this context for the function is the context passed into the evaluate method (rather than the parent object it's a part of). Now this will match behavior even on MDN's "this" page

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 1.5.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: