2024-05-13 10:51:12: merge [main:6f6359c4c01bf3e0cef37b14d6b016b7d5a1fa84];
This commit is contained in:
1 parent
2989c66a65
commit
739a9a3a4b
45 files changed
+4018
-309
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const sortObject = (obj: any): any => {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(sortObject)
|
||||
}
|
||||
|
||||
const sorted: any = {}
|
||||
Object.keys(obj)
|
||||
.sort()
|
||||
.forEach((key) => {
|
||||
sorted[key] = sortObject(obj[key])
|
||||
})
|
||||
return sorted
|
||||
}
|
||||
|
||||
export { sortObject }
|
||||
Reference in new issue
Block a user