xmlbuilder2
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -5,2 +5,11 @@ # Change Log | ||
## [1.4.3] - 2020-03-03 | ||
- `keepNullNodes` and `keepNullAttributes` flags now properly keep `null` | ||
**and** `undefined` values (See [#5](https://github.com/oozcitak/xmlbuilder2/issues/5)). | ||
## [1.4.2] - 2020-03-02 | ||
- Added `types` to `package.json` to help IDEs infer types (See [#4](https://github.com/oozcitak/xmlbuilder2/issues/4)). | ||
## [1.4.1] - 2020-02-28 | ||
@@ -45,2 +54,4 @@ | ||
[1.4.3]: https://github.com/oozcitak/xmlbuilder2/compare/v1.4.2...v1.4.3 | ||
[1.4.2]: https://github.com/oozcitak/xmlbuilder2/compare/v1.4.1...v1.4.2 | ||
[1.4.1]: https://github.com/oozcitak/xmlbuilder2/compare/v1.4.0...v1.4.1 | ||
@@ -47,0 +58,0 @@ [1.4.0]: https://github.com/oozcitak/xmlbuilder2/compare/v1.3.0...v1.4.0 |
@@ -149,3 +149,3 @@ "use strict"; | ||
} | ||
else if (!this._options.keepNullNodes && (val === null)) { | ||
else if (!this._options.keepNullNodes && (val == null)) { | ||
// skip null and undefined nodes | ||
@@ -231,3 +231,3 @@ lastChild = this._dummy(); | ||
} | ||
else if (util_1.isString(p1) && (p2 === null || util_1.isString(p2))) { | ||
else if (util_1.isString(p1) && (p2 == null || util_1.isString(p2))) { | ||
// ele(name: string, value: string) | ||
@@ -239,8 +239,8 @@ [namespace, name, value] = [undefined, p1, p2]; | ||
} | ||
if (this._options.keepNullAttributes && (value === null)) { | ||
if (this._options.keepNullAttributes && (value == null)) { | ||
// keep null attributes | ||
value = ""; | ||
} | ||
else if (value === null) { | ||
// skip null attributes | ||
else if (value == null) { | ||
// skip null|undefined attributes | ||
return this; | ||
@@ -247,0 +247,0 @@ } |
@@ -25,9 +25,9 @@ import { Node, Document } from "@oozcitak/dom/lib/dom/interfaces"; | ||
/** | ||
* Whether nodes with `null` values will be kept or ignored. Defaults to | ||
* `false`. | ||
* Whether nodes with `null` or `undefined` values will be kept or ignored. | ||
* Defaults to `false`. | ||
*/ | ||
keepNullNodes?: boolean; | ||
/** | ||
* Whether attributes with `null` values will be kept or ignored. Defaults to | ||
* `false`. | ||
* Whether attributes with `null` or `undefined` values will be kept or | ||
* ignored. Defaults to `false`. | ||
*/ | ||
@@ -34,0 +34,0 @@ keepNullAttributes?: boolean; |
{ | ||
"name": "xmlbuilder2", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "xml", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330105