aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/content-types-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-28 17:30:31 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-28 17:30:31 +0100
commit2888fa158d67c1419199f152326e12a05618b53e (patch)
treec239ed44678ba87f29ff9b84625cf1a0ba48a68a /lib/docx/content-types-reader.js
parent31f0c370be4b95ac4fa285fea3be970606735f16 (diff)
Create objects without prototypes when used as map with arbitrary keys
Diffstat (limited to 'lib/docx/content-types-reader.js')
-rw-r--r--lib/docx/content-types-reader.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/docx/content-types-reader.js b/lib/docx/content-types-reader.js
index 8233119..adb45a6 100644
--- a/lib/docx/content-types-reader.js
+++ b/lib/docx/content-types-reader.js
@@ -14,9 +14,9 @@ exports.defaultContentTypes = contentTypes({}, {});
function readContentTypesFromXml(element) {
- var extensionDefaults = {};
- var overrides = {};
-
+ var extensionDefaults = Object.create(null);
+ var overrides = Object.create(null);
+
element.children.forEach(function(child) {
if (child.name === "content-types:Default") {
extensionDefaults[child.attributes.Extension] = child.attributes.ContentType;
@@ -41,7 +41,7 @@ function contentTypes(overrides, extensionDefaults) {
} else {
var pathParts = path.split(".");
var extension = pathParts[pathParts.length - 1];
- if (extensionDefaults.hasOwnProperty(extension)) {
+ if (Object.prototype.hasOwnProperty.call(extensionDefaults, extension)) {
return extensionDefaults[extension];
} else {
var fallback = fallbackContentTypes[extension.toLowerCase()];
@@ -54,5 +54,5 @@ function contentTypes(overrides, extensionDefaults) {
}
}
};
-
+
}