diff --git a/src/index.js b/src/index.js index 4f1becb..a73c3bf 100644 --- a/src/index.js +++ b/src/index.js @@ -225,7 +225,7 @@ if (fs.existsSync(process.dirname + "/config.json")) { try { configJSONf = fs.readFileSync(process.dirname + "/config.json"); // Read JSON File try { - process.serverConfig = JSON.parse(configJSONf); // Parse JSON + process.serverConfig = Object.assign(Object.create(null), JSON.parse(configJSONf)); // Parse JSON and assign it to null prototype object } catch (err2) { configJSONPErr = err2; } diff --git a/src/utils/deepClone.js b/src/utils/deepClone.js index 133e737..e3c7504 100644 --- a/src/utils/deepClone.js +++ b/src/utils/deepClone.js @@ -1,5 +1,5 @@ // Function to deep clone an object or array -function deepClone(obj) { +function deepClone(obj, isFullObject) { if (typeof obj !== "object" || obj === null) { return obj; } @@ -31,7 +31,7 @@ function deepClone(obj) { }); return clone; } else { - const clone = {}; + const clone = isFullObject ? {} : Object.create(null); objectsArray.push(obj); clonesArray.push(clone); Object.keys(obj).forEach((key) => {