Skip to content

Node.js based forum software built for the modern web

refactor: remove object.create

Barış Soner Uşaklıdbba0c396be6
diff --git a/public/src/utils.js b/public/src/utils.js
index 2189c107e6..fb0eed6c5f 100644
--- a/public/src/utils.js
+++ b/public/src/utils.js
@@ -369,14 +369,14 @@
return utils.languageKeyRegex.test(input);
},
userLangToTimeagoCode: function (userLang) {
- const mapping = Object.create(null, {
+ const mapping = {
'en-GB': 'en',
'en-US': 'en',
'fa-IR': 'fa',
'pt-BR': 'pt-br',
nb: 'no',
- });
- return mapping[userLang] || userLang;
+ };
+ return mapping.hasOwnProperty(userLang) ? mapping[userLang] : userLang;
},
// shallow objects merge
merge: function () {
@@ -397,7 +397,7 @@
return ('' + path).split('.').pop();
},
- extensionMimeTypeMap: Object.create(null, {
+ extensionMimeTypeMap: {
bmp: 'image/bmp',
cmx: 'image/x-cmx',
cod: 'image/cis-cod',
@@ -421,7 +421,7 @@
xbm: 'image/x-xbitmap',
xpm: 'image/x-xpixmap',
xwd: 'image/x-xwindowdump',
- }),
+ },
fileMimeType: function (path) {
return utils.extensionToMimeType(utils.fileExtension(path));