lib: macro-ify type checks

Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
This commit is contained in:
Ben Noordhuis
2013-07-24 18:03:53 +02:00
parent 457d529241
commit 0330bdf519
38 changed files with 408 additions and 431 deletions

View File

@@ -60,21 +60,21 @@ exports.createServer = function(opts, requestListener) {
// HTTPS agents.
function createConnection(port, host, options) {
if (typeof port === 'object') {
if (IS_OBJECT(port)) {
options = port;
} else if (typeof host === 'object') {
} else if (IS_OBJECT(host)) {
options = host;
} else if (typeof options === 'object') {
} else if (IS_OBJECT(options)) {
options = options;
} else {
options = {};
}
if (typeof port === 'number') {
if (IS_NUMBER(port)) {
options.port = port;
}
if (typeof host === 'string') {
if (IS_STRING(host)) {
options.host = host;
}
@@ -115,7 +115,7 @@ Agent.prototype.getName = function(options) {
name += options.pfx;
name += ':';
if (options.rejectUnauthorized !== undefined)
if (!IS_UNDEFINED(options.rejectUnauthorized))
name += options.rejectUnauthorized;
return name;