-
Notifications
You must be signed in to change notification settings - Fork 8
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 #1312 from ASU/fix-rfi-submit-errors
fix(app-rfi): fix false error display on studentstatus
- Loading branch information
Showing
4 changed files
with
35 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function deepCloner(obj) { | ||
// Check if the object is null or not an object, return it if so | ||
if (obj === null || typeof obj !== 'object') { | ||
return obj; | ||
} | ||
|
||
// Handle Date | ||
if (obj instanceof Date) { | ||
return new Date(obj.getTime()); | ||
} | ||
|
||
// Handle Array | ||
if (Array.isArray(obj)) { | ||
const arrCopy = []; | ||
for (let i = 0; i < obj.length; i++) { | ||
arrCopy[i] = deepClone(obj[i]); | ||
} | ||
return arrCopy; | ||
} | ||
|
||
// Handle Object | ||
const objCopy = {}; | ||
for (const key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
objCopy[key] = deepCloner(obj[key]); | ||
} | ||
} | ||
return objCopy; | ||
}; | ||
|
||
export { deepCloner }; |
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