Dump UhkBuffer.toJsObject()

This commit is contained in:
László Monda
2016-04-03 19:09:49 +02:00
parent a0ed4bd5a7
commit b0b7a642a4

View File

@@ -35,7 +35,16 @@ abstract class Serializable<T> {
}
toJsObject(): any {
return this._toJsObject();
let indentation = new Array(Serializable.depth + 1).join(' ');
let isArray = this instanceof UhkArray;
process.stdout.write(`${indentation}${this.constructor.name}.toJsObject: ${this}` + (isArray ? '\n' : ` => `));
Serializable.depth++;
let value = this._toJsObject();
Serializable.depth--;
if (!isArray) {
process.stdout.write(`${JSON.stringify(value)}\n`);
}
return value;
}
toBinary(buffer: UhkBuffer): void {