Created
September 24, 2016 01:38
-
-
Save ljungmark/28a8fbc07fbdadf2450a3b18aa79c2cf to your computer and use it in GitHub Desktop.
Enforcing mandatory parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mandatory() { | |
throw new Error('Missing parameter'); | |
} | |
function foo(mustBeProvided = mandatory()) { | |
return mustBeProvided; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment