node-ldapjs/lib/messages/compare_response.js

34 lines
746 B
JavaScript
Raw Normal View History

2011-08-04 20:32:01 +00:00
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
2020-10-31 21:07:32 +00:00
const assert = require('assert-plus')
const util = require('util')
2011-08-04 20:32:01 +00:00
2020-10-31 21:07:32 +00:00
const LDAPResult = require('./result')
const Protocol = require('../protocol')
2011-08-04 20:32:01 +00:00
/// --- API
2011-08-04 20:32:01 +00:00
function CompareResponse (options) {
options = options || {}
assert.object(options)
2011-08-04 20:32:01 +00:00
options.protocolOp = Protocol.LDAP_REP_COMPARE
LDAPResult.call(this, options)
2011-08-04 20:32:01 +00:00
}
util.inherits(CompareResponse, LDAPResult)
CompareResponse.prototype.end = function (matches) {
2020-10-31 21:07:32 +00:00
let status = 0x06
if (typeof (matches) === 'boolean') {
if (!matches) { status = 0x05 } // Compare false
} else {
status = matches
}
return LDAPResult.prototype.end.call(this, status)
}
/// --- Exports
module.exports = CompareResponse