Yeah, it's a little surprising, which is what makes it probably too fancy. You'd want to have a very good reason to be using it, to weigh up against the fact that almost every single person reading it later will be like "hmm, does that run at definition or on call?" and then to also have to go and see what it does.
5
u/rezoner :table_flip: Apr 29 '19
Regarding isRequired trick. I have like 10+ experience with Javascript and I did not know that function as a default argument value will get executed at the call time - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#Evaluated_at_call_time