Skip to content

Commit

Permalink
use Object.keys
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Aug 6, 2023
1 parent a64c523 commit 4ab1265
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lib/core/util/mime-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,20 +978,14 @@ const table = {

const mimeTypes = (() => {
const mimeTypes = {};
for (const type in table) {
// eslint-disable-next-line no-prototype-builtins
if (table.hasOwnProperty(type)) {
for (const subtype in table[type]) {
// eslint-disable-next-line no-prototype-builtins
if (table[type].hasOwnProperty(subtype)) {
const value = table[type][subtype];
if (typeof value == "string") {
mimeTypes[value] = type + "/" + subtype;
} else {
for (let indexMimeType = 0; indexMimeType < value.length; indexMimeType++) {
mimeTypes[value[indexMimeType]] = type + "/" + subtype;
}
}
for (const type of Object.keys(table)) {
for (const subtype of Object.keys(table[type])) {
const value = table[type][subtype];
if (typeof value == "string") {
mimeTypes[value] = type + "/" + subtype;
} else {
for (let indexMimeType = 0; indexMimeType < value.length; indexMimeType++) {
mimeTypes[value[indexMimeType]] = type + "/" + subtype;
}
}
}
Expand Down

0 comments on commit 4ab1265

Please sign in to comment.