I did some benchmarks in different algorithms for checking if a collection has contents: https://jsperf.app/kopiro
Although we're probably taking the side of microoptimization here, as you can see, not doing the comparison with 0 gives +1M (Chromium) or +500K ops (Firefox), so I think it makes sense to at least provide the reversed rule for people desiring to enforce that (and shouldn't require much more logic?).
Description
I did some benchmarks in different algorithms for checking if a collection has contents: https://jsperf.app/kopiro
Although we're probably taking the side of microoptimization here, as you can see, not doing the comparison with 0 gives +1M (Chromium) or +500K ops (Firefox), so I think it makes sense to at least provide the reversed rule for people desiring to enforce that (and shouldn't require much more logic?).
Fail
Pass
Additional Info
No response