Last active
August 29, 2015 14:09
-
-
Save wmakeev/b3e3a0672a845581fa80 to your computer and use it in GitHub Desktop.
Check type
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
checkType = function(type, val, name) { | |
if (typeof val !== type) { | |
return "" + name + " has to be a " + type; | |
} | |
}; | |
err = checkType("string", id, "module ID") || checkType("function", creator, "creator") || checkType("object", options, "option parameter"); | |
if (err) { | |
this.log.error("could not register module '" + id + "': " + err); | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment