you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 2 years ago (1 child)

I just tested and Terser will convert v === null || v === undefined to null==v. Personally I would prefer to read the code that explicitly shows that it is checking for both and let my minifier/optimizer worry about generating compact code.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 0 points 2 years ago (1 child)

    Try changing to const === variable. That’s most likely what’s it doing to minimize the risk of accidental assignment.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 2 years ago (1 child)

    Wut? This is an automated optimizer. It is not worried about accidental assignment.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 2 years ago (1 child)

    I agree it shouldn’t. But I’ve seen linters that automatically change it since they seem to be forcing practical conventions sometimes.

  • source
  • parent
  • hideshow 2 child comments