ldapts
Advanced tools
Comparing version 3.0.7 to 3.1.0
# Change Log | ||
## 3.0.7 - 2020-09-14 | ||
## 3.1.0 - 2021-09-20 | ||
- Allow EqualityFilter to accept Buffer as a value | ||
## 3.0.7 - 2021-09-14 | ||
- Update npms | ||
@@ -6,0 +10,0 @@ |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import type { BerReader, BerWriter } from 'asn1'; | ||
@@ -6,3 +7,3 @@ import { SearchFilter } from '../SearchFilter'; | ||
attribute?: string; | ||
value?: string; | ||
value?: Buffer | string; | ||
} | ||
@@ -12,3 +13,3 @@ export declare class EqualityFilter extends Filter { | ||
attribute: string; | ||
value: string; | ||
value: Buffer | string; | ||
constructor(options?: EqualityFilterOptions); | ||
@@ -15,0 +16,0 @@ parseFilter(reader: BerReader): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EqualityFilter = void 0; | ||
const asn1_1 = require("asn1"); | ||
const SearchFilter_1 = require("../SearchFilter"); | ||
@@ -22,3 +23,8 @@ const Filter_1 = require("./Filter"); | ||
writer.writeString(this.attribute); | ||
writer.writeString(this.value); | ||
if (Buffer.isBuffer(this.value)) { | ||
writer.writeBuffer(this.value, asn1_1.Ber.OctetString); | ||
} | ||
else { | ||
writer.writeString(this.value); | ||
} | ||
} | ||
@@ -28,6 +34,10 @@ matches(objectToCheck = {}, strictAttributeCase) { | ||
if (typeof objectToCheckValue !== 'undefined') { | ||
if (strictAttributeCase) { | ||
if (Buffer.isBuffer(this.value) && Buffer.isBuffer(objectToCheckValue)) { | ||
return this.value === objectToCheckValue; | ||
} | ||
return this.value.toLowerCase() === objectToCheckValue.toLowerCase(); | ||
const stringValue = Buffer.isBuffer(this.value) ? this.value.toString('utf8') : this.value; | ||
if (strictAttributeCase) { | ||
return stringValue === objectToCheckValue; | ||
} | ||
return stringValue.toLowerCase() === objectToCheckValue.toLowerCase(); | ||
} | ||
@@ -34,0 +44,0 @@ return false; |
{ | ||
"name": "ldapts", | ||
"version": "3.0.7", | ||
"version": "3.1.0", | ||
"description": "LDAP client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
352952
5196