DEV Community

Discussion on: Washing your code: avoid conditions

Collapse
 
qm3ster profile image
Mihail Malo

I can never get over the shame of (products || []).map(.
Who knows what other things I will be doing with the resulting empty array afterwards?!
I always break out to imperative to do a

if (!Array.isArray(products)) return
const x = products.map(