xmljslib 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1039,7 +1039,7 @@ function isXMLRecord(value) {
|
|
|
1039
1039
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1040
1040
|
}
|
|
1041
1041
|
function getXMLAttributes(value) {
|
|
1042
|
-
return Object.entries(value).filter(([key]) => key.startsWith("$") && key !== "$value" && key !== "$namespace"
|
|
1042
|
+
return Object.entries(value).filter(([key]) => key.startsWith("$") && key !== "$value" && key !== "$namespace").map(([key, attrValue]) => {
|
|
1043
1043
|
const name = key.slice(1);
|
|
1044
1044
|
if (!name || !/^[A-Za-z_][\w.:-]*$/.test(name)) {
|
|
1045
1045
|
throw new Error(`Invalid XML attribute name: ${name}`);
|
package/dist/index.js
CHANGED
|
@@ -1001,7 +1001,7 @@ function isXMLRecord(value) {
|
|
|
1001
1001
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1002
1002
|
}
|
|
1003
1003
|
function getXMLAttributes(value) {
|
|
1004
|
-
return Object.entries(value).filter(([key]) => key.startsWith("$") && key !== "$value" && key !== "$namespace"
|
|
1004
|
+
return Object.entries(value).filter(([key]) => key.startsWith("$") && key !== "$value" && key !== "$namespace").map(([key, attrValue]) => {
|
|
1005
1005
|
const name = key.slice(1);
|
|
1006
1006
|
if (!name || !/^[A-Za-z_][\w.:-]*$/.test(name)) {
|
|
1007
1007
|
throw new Error(`Invalid XML attribute name: ${name}`);
|