|
|
|
|
|
by komali2
3270 days ago
|
|
>using as much syntax sugar as possible It's not possible to say this on the internet without being rude so, apologies, but, why code like that? It genuinely was a struggle to parse (in my brain) your oneliner of code there. If I found this in our code base it would be a huge waste of time and energy. |
|
I said I like to write it this way, not that I always do it.
> why code like that
It's a fun exercise.
> it would be a huge waste of time and energy
I don't fully agree on this: from the name and signature it's pretty clear what the function does, so you don't need to waste time "parsing" the details. And with unit tests it is also very low-risk.
But that's speculative, in a real project I'd just use lodash.