Use Object.entries() in Core/Language#addObject()
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 5 Feb 2021 15:05:26 +0000 (16:05 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 5 Feb 2021 15:05:26 +0000 (16:05 +0100)
ts/WoltLabSuite/Core/Language.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Language.js

index 8287e8b41c263dd808525a48bae3369bd3b83954..e61b0e62eec5e6dea384ba66ea07734a952da8e0 100644 (file)
@@ -18,8 +18,8 @@ export { get } from "./Language/Store";
  * Adds all the language items in the given object to the store.
  */
 export function addObject(object: LanguageItems): void {
-  Object.keys(object).forEach((key) => {
-    add(key, object[key]);
+  Object.entries(object).forEach(([key, value]) => {
+    add(key, value);
   });
 }
 
index 559835e40ae9c06e8358398ed397cea04ebb4cd6..ae76f0b437a4ef4175d33c6c43c10383fc9a1a9b 100644 (file)
@@ -17,8 +17,8 @@ define(["require", "exports", "tslib", "./Template", "./Language/Store", "./Lang
      * Adds all the language items in the given object to the store.
      */
     function addObject(object) {
-        Object.keys(object).forEach((key) => {
-            add(key, object[key]);
+        Object.entries(object).forEach(([key, value]) => {
+            add(key, value);
         });
     }
     exports.addObject = addObject;