diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-24 20:03:53 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-24 23:49:35 +0400 |
commit | 0330bdf5195eb77f04c26a09a8bd2088a261fe53 (patch) | |
tree | 2c13f9f1757bca93e83e425a028dcae78549f40e /lib/tls.js | |
parent | 457d52924152c6f2baf2fddbe76a03bca7bdde7c (diff) |
lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
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 6d2f59e36c5..a0d31bf6013 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -51,7 +51,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 (Array.isArray(NPNProtocols)) { + if (IS_ARRAY(NPNProtocols)) { var buff = new Buffer(NPNProtocols.reduce(function(p, c) { return p + 1 + Buffer.byteLength(c); }, 0)); @@ -68,7 +68,7 @@ exports.convertNPNProtocols = function convertNPNProtocols(NPNProtocols, out) { } // If it's already a Buffer - store it - if (Buffer.isBuffer(NPNProtocols)) { + if (IS_BUFFER(NPNProtocols)) { out.NPNProtocols = NPNProtocols; } }; @@ -166,7 +166,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { // RFC6125 if (matchCN) { var commonNames = cert.subject.CN; - if (Array.isArray(commonNames)) { + if (IS_ARRAY(commonNames)) { for (var i = 0, k = commonNames.length; i < k; ++i) { dnsNames.push(regexpify(commonNames[i], true)); } @@ -194,7 +194,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 (!Array.isArray(out[key])) { + if (!IS_ARRAY(out[key])) { out[key] = [out[key]]; } out[key].push(value); |