• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

246
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 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error