-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from motea927/dev
fix: force update with vite.config's option
- Loading branch information
Showing
4 changed files
with
76 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export function deepEqual(obj1: any, obj2: any, excludeProps: string[] = []): boolean { | ||
// Check if both objects are of the same type | ||
if (typeof obj1 !== typeof obj2) { | ||
return false | ||
} | ||
|
||
// Check if both objects are primitive types or null | ||
if (obj1 == null || obj2 == null || typeof obj1 !== 'object') { | ||
return obj1 === obj2 | ||
} | ||
|
||
// Get the keys of the objects | ||
const keys1 = Object.keys(obj1) | ||
const keys2 = Object.keys(obj2) | ||
|
||
// Check if the number of keys is the same | ||
if (keys1.length !== keys2.length) { | ||
return false | ||
} | ||
|
||
// Iterate through the keys and recursively compare the values | ||
for (const key of keys1) { | ||
// Check if the current key should be excluded | ||
if (excludeProps.includes(key)) { | ||
continue | ||
} | ||
|
||
if (!deepEqual(obj1[key], obj2[key], excludeProps)) { | ||
return false | ||
} | ||
} | ||
|
||
// If all comparisons passed, the objects are deep equal | ||
return true | ||
} |