Created
May 21, 2014 19:19
-
-
Save johnathan-sewell/1d701561a8cf4546af55 to your computer and use it in GitHub Desktop.
Use TypeError when checking input parameter types
This file contains hidden or 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
if (!options) { | |
throw new TypeError('options (object) is required'); | |
} | |
if (!options.username || !_.isString(options.username)) { | |
throw new TypeError('options.username (string) is required'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment