Skip to content

Commit 845accf

Browse files
authored
Merge pull request #500 from DogeisCut/extension-dogeiscutObject
Extension dogeiscut object
2 parents bb79332 + 5950fa5 commit 845accf

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

static/extensions/DogeisCut/dogeiscutObject.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,13 @@
282282
toJSON() {
283283
return Object.fromEntries(
284284
Object.entries(this.object).map(([key, value]) => {
285-
let proto = Object.getPrototypeOf(value)
286-
if (typeof value === "object" && value !== null && (proto !== null && proto !== defaultPrototype /* < lazy fix */)) {
287-
if (typeof value.toJSON === "function") return [key, value.toJSON()]
288-
if (typeof value.toString === "function") return [key, value.toString()]
289-
return [key, JSON.stringify(value)]
285+
if (typeof value === "object" && value !== null) {
286+
let proto = Object.getPrototypeOf(value)
287+
if (proto !== null && proto !== defaultPrototype /* < lazy fix */) {
288+
if (typeof value.toJSON === "function") return [key, value.toJSON()]
289+
if (typeof value.toString === "function") return [key, value.toString()]
290+
return [key, JSON.stringify(value)]
291+
}
290292
}
291293
return [key, value]
292294
})

0 commit comments

Comments
 (0)