Jul 29, 2017 · 1 min read
I had considered that initially, but I needed something that handle a default case and also allow a non default value to return null or undefined. So that’s why the design was like that.
Though if you have no need for a default case, your example is preferable.
Thanks for sharing!
