String encode/decode

This commit is contained in:
barsdeveloper
2022-04-25 19:59:54 +02:00
parent 1aa4ceb11c
commit fc0e850b4b
9 changed files with 108 additions and 25 deletions

View File

@@ -0,0 +1,20 @@
// @ts-check
import PinEntity from "../entity/PinEntity"
import Utility from "../Utility"
import GeneralSerializer from "./GeneralSerializer"
export default class PinSerializer extends GeneralSerializer {
constructor() {
super(v => `${PinEntity.lookbehind} (${v})`, PinEntity, "", ",", true)
}
writeValue(value, fullKey) {
if (value?.constructor === String && fullKey == "DefaultValue") {
// @ts-expect-error
return `"${Utility.encodeInputString(value)}"`
}
return super.writeValue(value, fullKey)
}
}