Skip to content

Commit abd2e4a

Browse files
authored
fix(object): change clone deep implementation to use object literal (#65)
fix(object): change clone deep implementation to use object literal
1 parent 8c923ee commit abd2e4a

File tree

4 files changed

+437
-365
lines changed

4 files changed

+437
-365
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
matrix:
1010
node-version:
1111
- 18
12+
- latest
1213
steps:
1314
- uses: actions/checkout@v3
1415
- name: Use Node.js ${{ matrix.node-version }}

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@
2626
"author": "OpenAPI Contrib",
2727
"license": "MIT",
2828
"dependencies": {
29-
"@types/node": "^18.15.11",
30-
"@types/json-schema": "^7.0.11",
29+
"@types/node": "^20.2.5",
30+
"@types/json-schema": "^7.0.12",
3131
"fast-deep-equal": "^3.1.3",
3232
"openapi-typescript": "^5.4.1"
3333
},
3434
"devDependencies": {
35-
"@typescript-eslint/eslint-plugin": "^5.57.0",
36-
"@typescript-eslint/parser": "^5.57.0",
37-
"c8": "^7.13.0",
38-
"eslint": "^8.37.0",
35+
"@typescript-eslint/eslint-plugin": "^5.59.8",
36+
"@typescript-eslint/parser": "^5.59.8",
37+
"c8": "^7.14.0",
38+
"eslint": "^8.42.0",
3939
"eslint-config-prettier": "^8.8.0",
4040
"eslint-plugin-prettier": "^4.2.1",
4141
"eslint-plugin-unused-imports": "^2.0.0",
42-
"prettier": "^2.8.7",
43-
"semantic-release": "^21.0.1",
44-
"typescript": "^5.0.3",
45-
"vitest": "^0.29.8"
42+
"prettier": "^2.8.8",
43+
"semantic-release": "^21.0.3",
44+
"typescript": "^5.1.3",
45+
"vitest": "^0.31.4"
4646
},
4747
"prettier": {
4848
"printWidth": 120,

src/lib/utils/cloneDeep.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Fromhttps://dev.to/salyadav/deep-clone-of-js-objects-with-circular-dependency-4if7
1+
// From https://dev.to/salyadav/deep-clone-of-js-objects-with-circular-dependency-4if7
22
const isArray = (val) => {
33
return Array.isArray(val);
44
};
@@ -17,7 +17,7 @@ export const cloneDeep = (val, history = new Set()) => {
1717
stack.add(val);
1818

1919
const copyObject = (o) => {
20-
const oo = Object.create({});
20+
const oo = {};
2121
for (const k in o) {
2222
oo[k] = cloneDeep(o[k], stack);
2323
}

0 commit comments

Comments
 (0)