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/tls.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/tls.js')
-rw-r--r-- | lib/tls.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tls.js b/lib/tls.js index d52adbabc8..0e13516add 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -36,7 +36,7 @@ exports.getCiphers = function() { // ("\x06spdy/2\x08http/1.1\x08http/1.0") exports.convertNPNProtocols = function convertNPNProtocols(NPNProtocols, out) { // If NPNProtocols is Array - translate it into buffer - if (util.isArray(NPNProtocols)) { + if (Array.isArray(NPNProtocols)) { var buff = new Buffer(NPNProtocols.reduce(function(p, c) { return p + 1 + Buffer.byteLength(c); }, 0)); @@ -53,7 +53,7 @@ exports.convertNPNProtocols = function convertNPNProtocols(NPNProtocols, out) { } // If it's already a Buffer - store it - if (util.isBuffer(NPNProtocols)) { + if (NPNProtocols instanceof Buffer) { out.NPNProtocols = NPNProtocols; } }; @@ -160,7 +160,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { // RFC6125 if (matchCN) { var commonNames = cert.subject.CN; - if (util.isArray(commonNames)) { + if (Array.isArray(commonNames)) { for (var i = 0, k = commonNames.length; i < k; ++i) { dnsNames.push(regexpify(commonNames[i], true)); } @@ -208,7 +208,7 @@ exports.parseCertString = function parseCertString(s) { var key = parts[i].slice(0, sepIndex); var value = parts[i].slice(sepIndex + 1); if (key in out) { - if (!util.isArray(out[key])) { + if (!Array.isArray(out[key])) { out[key] = [out[key]]; } out[key].push(value); |