Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda