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 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)

View File

@ -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",