I'm trying to understand the libraries used in this article and elsewhere, and there's some pretty mind bending stuff in there, among which is the line
(0, _invariant2.default)(opts.hasOwnProperty('apiKey'), 'You must pass an apiKey to use GoogleApi');
Searching GitHub shows this piece of code, or variations on it, has been reproduced in loads of projects (although I can't find where it originated).
I can see that it boils down to a call to a function named invariant
, but what I don't understand is the purpose of the comma operator with zero here.
Why not just write
_invariant2.default(opts.hasOwnProperty('apiKey'), 'You must pass an apiKey to use GoogleApi')