_ ; ?
Today I took a few minutes to familiarize myself with some lodash functions, and I wound up finding a good use case for mapValues
. It came in handy when I needed to map over the values in an object while preserving the keys.
Previously I would have done something like Object.keys(collection).map()...
and mapValues
gave me the same power with a little less clunkiness.
I decided to check out the source code and was surprised to find a recent, massive commit in the lodash codebase:
That’s a commit from the original author of lodash, removing all the semicolons from the source code. On the commit he provided the reason: “It’s personal preference with ES6+ style code.”
I have always thought that missing semicolons are automatically inserted by a JavaScript interpreter and therefore it is a bad, bad thing to leave them out (as the interpreter may insert them in surprising and possibly wrong places). I got that info from a lecture by Douglas Crockford.
Therefore I am surprised to see this commit in the lodash codebase. I’ll have to check more into it and talk to some gurus at my job to find out more.