Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Act like an eval #38

Closed
wants to merge 1 commit into from
Closed

Act like an eval #38

wants to merge 1 commit into from

Conversation

Llorx
Copy link
Contributor

@Llorx Llorx commented Jul 5, 2019

With these updates, sval can really act like eval, returning the value of the passed code, but with the context isolation sval offers.

I think that could be optional, but I think that don't damages anything just acting always as an eval.

let res1 = eval("10 * 2");
let res2 = sval.run("10 * 2");
console.log("Eval test 1", res1 === res2);

let res3 = eval("let aj = 123;const aj2 = aj*3;function pepe(asd, asd2) {return asd + asd2;} var cosas = 12; var a = 44; var b = cosas * 2 + a;b");
let res4 = sval.run("let aj = 123;const aj2 = aj*3;function pepe(asd, asd2) {return asd + asd2;} var cosas = 12; var a = 44; var b = cosas * 2 + a;b");
console.log("Eval test 2", res3 === res4);

@Llorx
Copy link
Contributor Author

Llorx commented Jul 5, 2019

Damn, created the PR with GitHub and fu*kd it up

@Llorx Llorx closed this Jul 5, 2019
@Llorx Llorx deleted the patch-3 branch July 5, 2019 08:09
@coveralls
Copy link

Pull Request Test Coverage Report for Build 201

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 73.745%

Totals Coverage Status
Change from base Build 179: 0.0%
Covered Lines: 1024
Relevant Lines: 1337

💛 - Coveralls

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.

None yet

2 participants