mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 16:54:41 +08:00
* WIP * WIP * wip * WIP * Several fixes * Tests wip port to playwright * WIP * Fix more tests * Serialization tests fixed * Several fixes for tests * Input options types * Type adjustments * Fix object reference parser * Tests fixes * More tests fixes
30 lines
751 B
JavaScript
Executable File
30 lines
751 B
JavaScript
Executable File
import Serializer from "./Serializer.js"
|
|
|
|
/**
|
|
* @template {AttributeConstructor<Attribute>} T
|
|
* @extends {Serializer<T>}
|
|
*/
|
|
export default class CustomSerializer extends Serializer {
|
|
|
|
#objectWriter
|
|
|
|
/**
|
|
* @param {(v: ConstructedType<T>, insideString: Boolean) => String} objectWriter
|
|
* @param {T} entityType
|
|
*/
|
|
constructor(objectWriter, entityType) {
|
|
super(entityType)
|
|
this.#objectWriter = objectWriter
|
|
}
|
|
|
|
/**
|
|
* @param {ConstructedType<T>} entity
|
|
* @param {Boolean} insideString
|
|
* @returns {String}
|
|
*/
|
|
doWrite(entity, insideString, indentation = "") {
|
|
let result = this.#objectWriter(entity, insideString)
|
|
return result
|
|
}
|
|
}
|