Various fixes

This commit is contained in:
barsdeveloper
2022-03-19 14:46:53 +01:00
parent 391a537a78
commit 42615b93f8
25 changed files with 267 additions and 131 deletions

View File

@@ -51,14 +51,14 @@ export default class ISerializer {
let result = ""
let fullKey = key.concat("")
const last = fullKey.length - 1
for (const property in object) {
for (const property of Object.getOwnPropertyNames(object)) {
fullKey[last] = property
const value = object[property]
if (object[property]?.constructor === Object) {
// Recursive call when finding an object
result += (result.length ? this.separator : "")
+ this.subWrite(fullKey, value)
} else if (this.showProperty(fullKey, value)) {
} else if (value !== undefined && this.showProperty(fullKey, value)) {
result += (result.length ? this.separator : "")
+ this.prefix
+ this.attributeKeyPrinter(fullKey)

View File

@@ -51,7 +51,7 @@ ${this.subWrite([], object)
+ object
.CustomProperties.map(pin => this.separator + this.prefix + "CustomProperties " + SerializerFactory.getSerializer(PinEntity).write(pin))
.join("")}
End Object`
End Object\n`
return result
}
}

View File

@@ -28,7 +28,7 @@ export default function initializeSerializerFactory() {
)
SerializerFactory.registerSerializer(
LocalizedTextEntity,
new GeneralSerializer(v => `${LocalizedTextEntity.lookbehind}(${v})`, LocalizedTextEntity, "", ",", false, "", _ => "")
new GeneralSerializer(v => `${LocalizedTextEntity.lookbehind}(${v})`, LocalizedTextEntity, "", ", ", false, "", _ => "")
)
SerializerFactory.registerSerializer(
PinReferenceEntity,