Skip to content

Commit

Permalink
add obj check
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Jan 20, 2024
1 parent 6467cda commit 7a34ae7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/shared/serialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ function isSerializable(val) {
if (!isSerializablePrimitiveOrPlainObject(val)) {
return false;
}
for (const property in val) {
if (Object.hasOwn(val, property)) {
if (!isSerializablePrimitiveOrPlainObject(val[property])) {
return false;
}
if (typeof val[property] === "object") {
if (!isSerializable(val[property])) {
if (typeof val === "object") {
for (const property in val) {
if (Object.hasOwn(val, property)) {
if (!isSerializablePrimitiveOrPlainObject(val[property])) {
return false;
}
if (typeof val[property] === "object") {
if (!isSerializable(val[property])) {
return false;
}
}
}
}
}
Expand Down

0 comments on commit 7a34ae7

Please sign in to comment.