Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 95ee4f5

Browse files
authored
Merge pull request #523 from ManfredSteiner/next
Fixing issue #434 (can delete attributes)
2 parents cf49ee0 + b66da2c commit 95ee4f5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/change.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Object.defineProperties(Change.prototype, {
8282
val[k].forEach(function (v) {
8383
_attr.addValue(v.toString());
8484
});
85-
} else {
85+
} else if (val[k] !== undefined && val[k] !== null) {
8686
_attr.addValue(val[k].toString());
8787
}
8888
this._modification = _attr;

test/client.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,22 @@ test('modify change plain object success', function (t) {
506506
});
507507

508508

509+
// https://github.com/ldapjs/node-ldapjs/pull/435
510+
test('can delete attributes', function (t) {
511+
try {
512+
var change = new Change({
513+
type: 'Delete',
514+
modification: { cn: null }
515+
});
516+
t.ok(true);
517+
t.end();
518+
} catch (err) {
519+
t.ifError(err);
520+
t.end();
521+
}
522+
});
523+
524+
509525
test('modify array success', function (t) {
510526
var changes = [
511527
new Change({

0 commit comments

Comments
 (0)