From bc897f9fd4338804d0c3e8e4b3fae1239ad907cb Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Fri, 17 Jan 2014 09:52:26 -0800 Subject: [PATCH] lint/test cleanup --- lib/messages/ext_request.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/messages/ext_request.js b/lib/messages/ext_request.js index 6147279..0056ac7 100644 --- a/lib/messages/ext_request.js +++ b/lib/messages/ext_request.js @@ -27,7 +27,8 @@ function ExtendedRequest(options) { throw new TypeError('options must be an object'); if (options.requestName && typeof (options.requestName) !== 'string') throw new TypeError('options.requestName must be a string'); - if (options.requestValue && !(Buffer.isBuffer(options.requestValue) || typeof (options.requestValue) === 'string')) + if (options.requestValue && !(Buffer.isBuffer(options.requestValue) || + typeof (options.requestValue) === 'string')) throw new TypeError('options.requestValue must be a buffer or a string'); } else { options = {}; @@ -37,7 +38,7 @@ function ExtendedRequest(options) { LDAPMessage.call(this, options); this.requestName = options.requestName || ''; - this.requestValue = options.requestValue || undefined; + this.requestValue = options.requestValue; this.__defineGetter__('type', function () { return 'ExtendedRequest'; }); this.__defineGetter__('_dn', function () { return this.requestName; }); @@ -85,8 +86,9 @@ ExtendedRequest.prototype._toBer = function (ber) { ber.writeString(this.requestName, 0x80); if (Buffer.isBuffer(this.requestValue)) ber.writeBuffer(this.requestValue, 0x81); - else + else { ber.writeString(this.requestValue, 0x81); + } return ber; }; @@ -96,7 +98,8 @@ ExtendedRequest.prototype._json = function (j) { assert.ok(j); j.requestName = this.requestName; - j.requestValue = (Buffer.isBuffer(this.requestValue)) ? this.requestValue.toString('hex') : this.requestValue; + j.requestValue = (Buffer.isBuffer(this.requestValue)) ? + this.requestValue.toString('hex') : this.requestValue; return j; };