Created
January 31, 2012 19:38
-
-
Save mcavage/1712462 to your computer and use it in GitHub Desktop.
Argument checking simplification
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
if (!String.prototype.capitalize) { | |
String.prototype.capitalize = function() { | |
return this.charAt(0).toUpperCase() + this.slice(1); | |
} | |
} | |
function assertArg(name, type) { | |
if (typeof(name) !== type) | |
throw new TypeError(name + '(' + type.capitalize() + ') required'); | |
} | |
CA.prototype.listSchema = function(customer, callback) { | |
assertArg(customer, 'string'); | |
assertArg(callback, 'function'); | |
var path = sprintf(CA_FMT, customer); | |
return this.client.get(path, commonCallback(callback)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment