summaryrefslogtreecommitdiff
path: root/lib/tls.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-07-24 18:03:53 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-07-24 21:49:35 +0200
commit0330bdf5195eb77f04c26a09a8bd2088a261fe53 (patch)
tree2c13f9f1757bca93e83e425a028dcae78549f40e /lib/tls.js
parent457d52924152c6f2baf2fddbe76a03bca7bdde7c (diff)
downloadandroid-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.tar.gz
android-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.tar.bz2
android-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.zip
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.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 6d2f59e36c..a0d31bf601 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);