-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hey, I've spotted that when you use sorting on object which has values like Date, Set etc. they are vanished (they are set to {} - empty object)
Simple reproduction
const obj = {
a: 1,
b: 2,
c: new Date(),
d: [
{
a: 1,
c: 3,
b: 2,
z: 26,
set: new Set([1, 2, 3]),
date: {
from: new Date(),
to: new Date(),
},
},
],
}
const sortedObj = sortObject(obj);result:
{
"a": 1,
"b": 2,
"c": {},
"d": [
{
"a": 1,
"b": 2,
"c": 3,
"date": {
"from": {},
"to": {}
},
"set": {},
"z": 26
}
]
}
expected result:
{
a: 1,
b: 2,
c: 2024-04-22T15:13:16.020Z,
d: [
{
a: 1,
b: 2,
c: 3,
date: { from: 2024-04-22T15:13:16.020Z, to: 2024-04-22T15:13:16.020Z },
set: Set(3) { 1, 2, 3 },
z: 26
}
]
}
I'm not sure if this is a bug or feature but I'll open a PR soon for this and leave it up to you to decide whether to merge this :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels