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:
Kristjan ESPERANTO
2024-01-08 20:16:26 +01:00
committed by GitHub
parent 4bbd35fa6a
commit b47600e0d8
4 changed files with 5 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ _This release is scheduled to be released on 2024-04-01._
### Updated
- Use node prefix for build-in modules
- Removing lodash dependency by replacing merge by spread operator (#3339)
- Use node prefix for build-in modules (#3340)
### Fixed

1
package-lock.json generated
View File

@@ -38,7 +38,6 @@
"jest": "^29.7.0",
"jsdom": "^23.0.1",
"lint-staged": "^15.2.0",
"lodash": "^4.17.21",
"playwright": "^1.40.1",
"prettier": "^3.1.1",
"sinon": "^17.0.1",

View File

@@ -59,7 +59,6 @@
"jest": "^29.7.0",
"jsdom": "^23.0.1",
"lint-staged": "^15.2.0",
"lodash": "^4.17.21",
"playwright": "^1.40.1",
"prettier": "^3.1.1",
"sinon": "^17.0.1",

View File

@@ -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 = {}) => {