lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

Remove explicit casting to Boolean #12

Closedhavenchykclosed 1 commit intomasterfromrefs/pull/12/head
  1. HA

    There is no need to explicitly cast the expression inside `if` statement to boolean, so we can remove `!!`.

    Please let me know if it was done by intention @lukeed

    Locally benchmarks show weird results even if I don't change anything

  2. lukeedmentioned7 years ago on GitHub

  3. lukeedsubscribed7 years ago on GitHub

  4. LU

    Hey, thank you

    It was intentional. It's a deoptimization to have V8 infer/cast to boolean types for you. It may not greatly affect the benchmark numbers significantly (though usually it does), but at runtime/in the wild, it will leave the user code running in a deoptimized state

  5. HA
    Author

    Good to know, thanks @lukeed

  6. havenchykclosed7 years ago on GitHub

  7. lukeedmentioned7 years ago on GitHub

  8. lukeedsubscribed7 years ago on GitHub