rebase to branch next, fixing issue #434 (can delete attributes)

This commit is contained in:
Manfred Steiner 2019-08-26 08:22:26 +02:00
parent cf49ee03f8
commit b66da2c76e
2 changed files with 17 additions and 1 deletions

View File

@ -82,7 +82,7 @@ Object.defineProperties(Change.prototype, {
val[k].forEach(function (v) {
_attr.addValue(v.toString());
});
} else {
} else if (val[k] !== undefined && val[k] !== null) {
_attr.addValue(val[k].toString());
}
this._modification = _attr;

View File

@ -506,6 +506,22 @@ test('modify change plain object success', function (t) {
});
// https://github.com/ldapjs/node-ldapjs/pull/435
test('can delete attributes', function (t) {
try {
var change = new Change({
type: 'Delete',
modification: { cn: null }
});
t.ok(true);
t.end();
} catch (err) {
t.ifError(err);
t.end();
}
});
test('modify array success', function (t) {
var changes = [
new Change({