Skip to content

Instantly share code, notes, and snippets.

@johnathan-sewell
Created May 21, 2014 19:19
Show Gist options
  • Save johnathan-sewell/1d701561a8cf4546af55 to your computer and use it in GitHub Desktop.
Save johnathan-sewell/1d701561a8cf4546af55 to your computer and use it in GitHub Desktop.
Use TypeError when checking input parameter types
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