From 027e905e296366537356ff39edd05eec0f616838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=A4hr?= Date: Tue, 19 Dec 2023 23:05:37 +0100 Subject: [PATCH] fix: use Object.assign() Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- utils/sortJSON.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/utils/sortJSON.js b/utils/sortJSON.js index 4bb8c96..2c86dcf 100644 --- a/utils/sortJSON.js +++ b/utils/sortJSON.js @@ -23,11 +23,8 @@ fs.readFile(filepath, 'utf-8', (err, data) => { period: [] }; - Object.keys(defaultStructure).forEach((key) => { - if (!entry.hasOwnProperty(key)) { - entry[key] = defaultStructure[key]; - } - }); + Object.assign(defaultStructure, entry); + return defaultStructure; }); // Sort the JSON array by the "title" field