lint/test cleanup

This commit is contained in:
Mark Cavage 2014-01-17 09:52:26 -08:00
parent 2f1b0790f6
commit bc897f9fd4
1 changed files with 7 additions and 4 deletions

View File

@ -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;
};