Skip to content

Commit 5851754

Browse files
authored
Replace lodash cloneDeep with structuredClone
structuredClone is available in Node.js since version 17.0.0. As this package supports Node.js 18.0.0 and up, we're able to drop production dependency on lodash, making the package footprint smaller and install times faster.
1 parent 540b3c0 commit 5851754

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

package-lock.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"@azure/functions": "^4.0.0",
4646
"axios": "^1.6.1",
4747
"debug": "~2.6.9",
48-
"lodash": "^4.17.15",
4948
"moment": "^2.29.2",
5049
"uuid": "^9.0.1",
5150
"validator": "~13.7.0"
@@ -71,6 +70,7 @@
7170
"eslint": "^7.32.0",
7271
"eslint-config-prettier": "^6.15.0",
7372
"eslint-plugin-prettier": "^3.4.1",
73+
"lodash": "^4.17.15",
7474
"mocha": "^9.1.3",
7575
"nock": "^10.0.6",
7676
"prettier": "^2.0.5",

src/durableClient/getClient.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { DurableClientInput } from "durable-functions";
33
import { DurableClient } from "./DurableClient";
44
import { OrchestrationClientInputData } from "./OrchestrationClientInputData";
55
/** @hidden */
6-
import cloneDeep = require("lodash/cloneDeep");
7-
/** @hidden */
86
import url = require("url");
97
import { HttpCreationPayload } from "../http/HttpCreationPayload";
108
import { HttpManagementPayload } from "../http/HttpManagementPayload";
@@ -53,7 +51,7 @@ function getClientData(
5351

5452
/** @hidden */
5553
function correctClientData(clientData: OrchestrationClientInputData): OrchestrationClientInputData {
56-
const returnValue = cloneDeep(clientData);
54+
const returnValue = structuredClone(clientData);
5755

5856
returnValue.creationUrls = correctUrls(clientData.creationUrls) as HttpCreationPayload;
5957
returnValue.managementUrls = correctUrls(clientData.managementUrls) as HttpManagementPayload;
@@ -62,7 +60,7 @@ function correctClientData(clientData: OrchestrationClientInputData): Orchestrat
6260
}
6361

6462
function correctUrls(obj: { [key: string]: string }): { [key: string]: string } {
65-
const returnValue = cloneDeep(obj);
63+
const returnValue = structuredClone(obj);
6664

6765
const keys = Object.getOwnPropertyNames(obj);
6866
keys.forEach((key) => {

0 commit comments

Comments
 (0)