mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: undef handling
This commit is contained in:
1 parent
c16a5f1701
commit
bcda936585
1 file changed
+3
-2
@@ -27,6 +27,7 @@ enum FastStringFormat {
|
||||
}
|
||||
|
||||
export type CdonValue =
|
||||
| undefined
|
||||
| null
|
||||
| boolean
|
||||
| number
|
||||
@@ -212,7 +213,7 @@ export class CdonWriteStream extends WriteStream {
|
||||
object: CdonValue,
|
||||
stringTable: Map<string, number>,
|
||||
) {
|
||||
if (object === null) {
|
||||
if (object === null || object === undefined) {
|
||||
this.uint8(ValueType.Null);
|
||||
} else if (typeof object === 'boolean') {
|
||||
this.uint8(ValueType.Boolean);
|
||||
@@ -289,7 +290,7 @@ export class CdonWriteStream extends WriteStream {
|
||||
object.forEach((value) =>
|
||||
this.value(fastStringFormat, value, stringTable),
|
||||
);
|
||||
} else if (object !== undefined) {
|
||||
} else {
|
||||
const entries = Object.entries(object).filter(
|
||||
([, value]) => value !== undefined,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user