@thi.ng/hiccup
Advanced tools
Comparing version 5.1.30 to 5.2.0
# Change Log | ||
- **Last updated**: 2024-04-23T07:02:18Z | ||
- **Last updated**: 2024-04-25T19:44:55Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
## [5.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup@5.2.0) (2024-04-25) | ||
#### 🚀 Features | ||
- add `SerializeOpts.xml`, update serializeAttrib ([8fdcab9](https://github.com/thi-ng/umbrella/commit/8fdcab9)) | ||
### [5.1.29](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup@5.1.29) (2024-04-20) | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "@thi.ng/hiccup", | ||
"version": "5.1.30", | ||
"version": "5.2.0", | ||
"description": "HTML/SVG/XML serialization of nested data structures, iterables & closures", | ||
@@ -131,3 +131,3 @@ "type": "module", | ||
}, | ||
"gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n" | ||
"gitHead": "aed3421c21044c005fbcb7cc37965ccf85a870d2\n" | ||
} |
@@ -186,3 +186,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Package sizes (brotli'd, pre-treeshake): ESM: 2.17 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 2.19 KB | ||
@@ -189,0 +189,0 @@ ## Dependencies |
@@ -39,2 +39,14 @@ import type { FnU } from "@thi.ng/api"; | ||
keys: boolean; | ||
/** | ||
* If true, some serialization behaviors will be adjusted to target XML | ||
* output. | ||
* | ||
* @remarks | ||
* Currently, the following aspects are supported: | ||
* | ||
* - boolean attributes are serialized as `name=""` rather than just `name` | ||
* | ||
* @defaultValue false | ||
*/ | ||
xml: boolean; | ||
} | ||
@@ -41,0 +53,0 @@ /** |
@@ -26,4 +26,5 @@ import { deref, isDeref } from "@thi.ng/api/deref"; | ||
escapeFn: escapeEntitiesNum, | ||
keys: false, | ||
span: false, | ||
keys: false, | ||
xml: false, | ||
...opts | ||
@@ -65,3 +66,3 @@ }; | ||
const serializeAttrib = (attribs, a, v, opts) => { | ||
return v == null ? null : isFunction(v) && (/^on\w+/.test(a) || (v = v(attribs)) == null) ? null : v === true ? " " + a : v === false ? null : a === "data" ? serializeDataAttribs(v, opts) : attribPair(a, v, opts); | ||
return v == null ? null : isFunction(v) && (/^on\w+/.test(a) || (v = v(attribs)) == null) ? null : v === true ? " " + a + (opts.xml ? `=""` : "") : v === false ? null : a === "data" ? serializeDataAttribs(v, opts) : attribPair(a, v, opts); | ||
}; | ||
@@ -68,0 +69,0 @@ const attribPair = (a, v, opts) => { |
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
77171
572