Skip to content

Commit 902f6b3

Browse files
authored
Fix serializer (#517)
wow the way i did this before is even more dumb than i thought
1 parent 933e06d commit 902f6b3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

static/extensions/DogeisCut/dogeiscutObject.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,17 @@
545545
entries => {
546546
// this is here because for some reason i decided to do it like that in the old format
547547
if (entries.entries && Array.isArray(entries.entries)) { // this shouldn't trigger a false positive for a jwArray
548-
entries = entries.entries.map(({key, value}) => [key, value])
548+
entries = entries.entries.map((entry) => {
549+
const key = entry.key
550+
if (entry.customType == true) {
551+
const value = { ...entry }
552+
delete value.key
553+
return [key, value]
554+
}
555+
return [key, entry.value]
556+
})
549557
}
558+
// this is for converting from the new format
550559
return new dogeiscutObject.Type(new Map(entries.map(([key, value]) => {
551560
if (typeof value == "object" && value != null && value.customType) {
552561
return [String(key), vm.runtime.serializers[value.typeId].deserialize(value.serialized)]

0 commit comments

Comments
 (0)