UNPKG

746 BJavaScriptView Raw
1// Copyright 2011 Mark Cavage, Inc. All rights reserved.
2
3const assert = require('assert-plus')
4const util = require('util')
5
6const LDAPResult = require('./result')
7const Protocol = require('../protocol')
8
9/// --- API
10
11function CompareResponse (options) {
12 options = options || {}
13 assert.object(options)
14
15 options.protocolOp = Protocol.LDAP_REP_COMPARE
16 LDAPResult.call(this, options)
17}
18util.inherits(CompareResponse, LDAPResult)
19
20CompareResponse.prototype.end = function (matches) {
21 let status = 0x06
22 if (typeof (matches) === 'boolean') {
23 if (!matches) { status = 0x05 } // Compare false
24 } else {
25 status = matches
26 }
27
28 return LDAPResult.prototype.end.call(this, status)
29}
30
31/// --- Exports
32
33module.exports = CompareResponse