mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +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 =
|
export type CdonValue =
|
||||||
|
| undefined
|
||||||
| null
|
| null
|
||||||
| boolean
|
| boolean
|
||||||
| number
|
| number
|
||||||
@@ -212,7 +213,7 @@ export class CdonWriteStream extends WriteStream {
|
|||||||
object: CdonValue,
|
object: CdonValue,
|
||||||
stringTable: Map<string, number>,
|
stringTable: Map<string, number>,
|
||||||
) {
|
) {
|
||||||
if (object === null) {
|
if (object === null || object === undefined) {
|
||||||
this.uint8(ValueType.Null);
|
this.uint8(ValueType.Null);
|
||||||
} else if (typeof object === 'boolean') {
|
} else if (typeof object === 'boolean') {
|
||||||
this.uint8(ValueType.Boolean);
|
this.uint8(ValueType.Boolean);
|
||||||
@@ -289,7 +290,7 @@ export class CdonWriteStream extends WriteStream {
|
|||||||
object.forEach((value) =>
|
object.forEach((value) =>
|
||||||
this.value(fastStringFormat, value, stringTable),
|
this.value(fastStringFormat, value, stringTable),
|
||||||
);
|
);
|
||||||
} else if (object !== undefined) {
|
} else {
|
||||||
const entries = Object.entries(object).filter(
|
const entries = Object.entries(object).filter(
|
||||||
([, value]) => value !== undefined,
|
([, value]) => value !== undefined,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user