diff options
author | cjihrig <cjihrig@gmail.com> | 2015-01-28 20:05:53 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-01-31 23:47:29 -0500 |
commit | 6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40 (patch) | |
tree | 29a3b1ce92cfad3ae5d41a4ba7451846beace950 /lib/https.js | |
parent | bce7a2608eb198eee6ecd7991062efd6daeeb440 (diff) | |
download | android-node-v8-6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40.tar.gz android-node-v8-6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40.tar.bz2 android-node-v8-6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40.zip |
lib: reduce util.is*() usage
Many of the util.is*() methods used to check data types
simply compare against a single value or the result of
typeof. This commit replaces calls to these methods with
equivalent checks. This commit does not touch calls to the
more complex methods (isRegExp(), isDate(), etc.).
Fixes: https://github.com/iojs/io.js/issues/607
PR-URL: https://github.com/iojs/io.js/pull/647
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/https.js')
-rw-r--r-- | lib/https.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/https.js b/lib/https.js index acbbe0b6c2..4ee15b2537 100644 --- a/lib/https.js +++ b/lib/https.js @@ -4,7 +4,7 @@ const tls = require('tls'); const url = require('url'); const http = require('http'); const util = require('util'); -const inherits = require('util').inherits; +const inherits = util.inherits; const debug = util.debuglog('https'); function Server(opts, requestListener) { @@ -41,21 +41,21 @@ exports.createServer = function(opts, requestListener) { // HTTPS agents. function createConnection(port, host, options) { - if (util.isObject(port)) { + if (port !== null && typeof port === 'object') { options = port; - } else if (util.isObject(host)) { + } else if (host !== null && typeof host === 'object') { options = host; - } else if (util.isObject(options)) { + } else if (options !== null && typeof options === 'object') { options = options; } else { options = {}; } - if (util.isNumber(port)) { + if (typeof port === 'number') { options.port = port; } - if (util.isString(host)) { + if (typeof host === 'string') { options.host = host; } @@ -96,7 +96,7 @@ Agent.prototype.getName = function(options) { name += options.pfx; name += ':'; - if (!util.isUndefined(options.rejectUnauthorized)) + if (options.rejectUnauthorized !== undefined) name += options.rejectUnauthorized; return name; @@ -108,7 +108,7 @@ exports.globalAgent = globalAgent; exports.Agent = Agent; exports.request = function(options, cb) { - if (util.isString(options)) { + if (typeof options === 'string') { options = url.parse(options); } else { options = util._extend({}, options); |