Merge branch 'master' into use-dependabot

This commit is contained in:
Tony Brix 2020-07-21 17:32:52 -05:00 committed by GitHub
commit 41d17988de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -2,14 +2,10 @@
// var assert = require('assert')
var asn1 = require('asn1')
var Protocol = require('../protocol')
/// --- Globals
var BerWriter = asn1.BerWriter
var TYPES = {
and: Protocol.FILTER_AND,
or: Protocol.FILTER_OR,
@ -38,9 +34,18 @@ function isFilter (filter) {
return false
}
function isBerWriter (ber) {
return Boolean(
ber &&
typeof (ber) === 'object' &&
typeof (ber.startSequence) === 'function' &&
typeof (ber.endSequence) === 'function'
)
}
function mixin (target) {
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 = this._toBer(ber)

View File

@ -3,7 +3,7 @@
"name": "ldapjs",
"homepage": "http://ldapjs.org",
"description": "LDAP client and server APIs",
"version": "2.0.0",
"version": "2.1.0",
"license": "MIT",
"repository": {
"type": "git",