Remove instanceof check in filter#toBer mixin

For #629
This commit is contained in:
Robert Kawecki 2020-07-16 14:32:04 +02:00
parent 8b70279c57
commit 3c5138de26
1 changed files with 1 additions and 5 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,
@ -40,7 +36,7 @@ function isFilter (filter) {
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 (!ber) { throw new TypeError('ber (BerWriter) required') }
ber.startSequence(TYPES[this.type]) ber.startSequence(TYPES[this.type])
ber = this._toBer(ber) ber = this._toBer(ber)