Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
The sick thing about this is, imo it even improves readability.
In perl for example such one-liners get plain black magic pretty fast but in js, with implicit returns, object deconstruction and stuff you understand it even better. -
I would avoid side-effects by making years and period_types and all_periods arguments of this function. Makes unit-testing much easier as you are not dependent on an object state.
Aim for pure functions.
Related Rants

What only relying on JavaScript for HTML form input validation looks like
Found something true as 1 == 1
When you reduce a function from 16 lines to this, you know ES6 is in good hands now.
joke/meme
js
es6