mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 21:11:17 +00:00
Remove lodash (#3339)
Removing lodash dependency by replacing merge by spread operator. I have also split the return into two variables to make it easier to understand what is happening.
This commit is contained in:
committed by
GitHub
parent
4bbd35fa6a
commit
b47600e0d8
@@ -2,7 +2,6 @@ const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const util = require("node:util");
|
||||
const exec = util.promisify(require("node:child_process").exec);
|
||||
const _ = require("lodash");
|
||||
|
||||
/**
|
||||
* @param {string} type what data to read, can be "current" "forecast" or "hourly
|
||||
@@ -25,7 +24,9 @@ const readMockData = (type, extendedData = {}) => {
|
||||
break;
|
||||
}
|
||||
|
||||
return JSON.stringify(_.merge({}, JSON.parse(fs.readFileSync(path.resolve(`${__dirname}/../mocks/${fileName}`)).toString()), extendedData));
|
||||
const fileData = JSON.parse(fs.readFileSync(path.resolve(`${__dirname}/../mocks/${fileName}`)).toString());
|
||||
const mergedData = JSON.stringify({ ...{}, ...fileData, ...extendedData });
|
||||
return mergedData;
|
||||
};
|
||||
|
||||
const injectMockData = (configFileName, extendedData = {}) => {
|
||||
|
Reference in New Issue
Block a user