Skip to content

Commit

Permalink
Remove lodash (#3339)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KristjanESPERANTO committed Jan 8, 2024
1 parent 4bbd35f commit b47600e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions tests/utils/weather_mocker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = {}) => {
Expand Down

0 comments on commit b47600e

Please sign in to comment.