Further tweak the display of the buffer dump.
This commit is contained in:
@@ -22,10 +22,7 @@ abstract class Serializable<T> {
|
|||||||
fromBinary(buffer: UhkBuffer): T {
|
fromBinary(buffer: UhkBuffer): T {
|
||||||
let indentation = new Array(Serializable.depth + 1).join(' ');
|
let indentation = new Array(Serializable.depth + 1).join(' ');
|
||||||
let isArray = this instanceof UhkArray;
|
let isArray = this instanceof UhkArray;
|
||||||
process.stdout.write(`${indentation}${this.constructor.name}.fromBinary: [`);
|
process.stdout.write(`${indentation}${this.constructor.name}.fromBinary:` + (isArray ? '\n' : ' ['));
|
||||||
if (isArray) {
|
|
||||||
process.stdout.write('\n');
|
|
||||||
}
|
|
||||||
Serializable.depth++;
|
Serializable.depth++;
|
||||||
buffer.enableDump = !isArray;
|
buffer.enableDump = !isArray;
|
||||||
let value = this._fromBinary(buffer);
|
let value = this._fromBinary(buffer);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class UhkBuffer {
|
|||||||
dump(value) {
|
dump(value) {
|
||||||
if (this.enableDump) {
|
if (this.enableDump) {
|
||||||
if (!UhkBuffer.isFirstElementToDump) {
|
if (!UhkBuffer.isFirstElementToDump) {
|
||||||
process.stdout.write(' ');
|
process.stdout.write(', ');
|
||||||
}
|
}
|
||||||
process.stdout.write(value);
|
process.stdout.write(value);
|
||||||
if (UhkBuffer.isFirstElementToDump) {
|
if (UhkBuffer.isFirstElementToDump) {
|
||||||
|
|||||||
Reference in New Issue
Block a user