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

304
Views
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
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!