Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
Want to use something like an eval() or Function() to evaluate a string inside of a serverless project

I need to evaluate a string that I get in a function parameter. I've done it before using both eval() and Function(). But when I try the same thing with eval() inside of an AWS serverless project, I get a serverless webpack compilation error saying "eval can be harmful" and when I try Function(), I get an error "The Function constructor is eval".

The code is something like this:

function evaluate(x, op, y) {
    const expression = `x + op + y`;
    return eval(expression); // or return Function(`return ${expression}`)
}

Any ideas how I can bypass the serverless webpack error? Or is there any better way to evaluate a string altogether?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!