Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

305
Vistas
Terser: Annotate function as always pure (and what does it mean)

To assist with optimization Terser supports the pure comment to indicate that a function call is pure. Specifically, the docs give only the following example.

const x = /*#__PURE__*/i_am_dropped_if_x_is_not_used()

But, usually, if I define a pure function every use of it is pure. Is there a way to use comments to indicate that the function is always pure? If not do I have to manually list out the functions and pass them into the pure_funcs option?

--

Also, does the pure annotation really require that that the function be pure in a mathematical/functional programming sense, or is it enough that it be idempotent? For instance, if the function getModel(id) keeps a cache behind the scenes to improve performance will it cause problems if I mark it as pure?

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda