Merge branch 'master' into use-dependabot
This commit is contained in:
commit
41d17988de
|
@ -2,14 +2,10 @@
|
||||||
|
|
||||||
// var assert = require('assert')
|
// var assert = require('assert')
|
||||||
|
|
||||||
var asn1 = require('asn1')
|
|
||||||
|
|
||||||
var Protocol = require('../protocol')
|
var Protocol = require('../protocol')
|
||||||
|
|
||||||
/// --- Globals
|
/// --- Globals
|
||||||
|
|
||||||
var BerWriter = asn1.BerWriter
|
|
||||||
|
|
||||||
var TYPES = {
|
var TYPES = {
|
||||||
and: Protocol.FILTER_AND,
|
and: Protocol.FILTER_AND,
|
||||||
or: Protocol.FILTER_OR,
|
or: Protocol.FILTER_OR,
|
||||||
|
@ -38,9 +34,18 @@ function isFilter (filter) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isBerWriter (ber) {
|
||||||
|
return Boolean(
|
||||||
|
ber &&
|
||||||
|
typeof (ber) === 'object' &&
|
||||||
|
typeof (ber.startSequence) === 'function' &&
|
||||||
|
typeof (ber.endSequence) === 'function'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function mixin (target) {
|
function mixin (target) {
|
||||||
target.prototype.toBer = function toBer (ber) {
|
target.prototype.toBer = function toBer (ber) {
|
||||||
if (!ber || !(ber instanceof BerWriter)) { throw new TypeError('ber (BerWriter) required') }
|
if (isBerWriter(ber) === false) { throw new TypeError('ber (BerWriter) required') }
|
||||||
|
|
||||||
ber.startSequence(TYPES[this.type])
|
ber.startSequence(TYPES[this.type])
|
||||||
ber = this._toBer(ber)
|
ber = this._toBer(ber)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "ldapjs",
|
"name": "ldapjs",
|
||||||
"homepage": "http://ldapjs.org",
|
"homepage": "http://ldapjs.org",
|
||||||
"description": "LDAP client and server APIs",
|
"description": "LDAP client and server APIs",
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
Loading…
Reference in New Issue