Skip to content

Commit

Permalink
Merge pull request #6 from DanielRuf/fix/remove-trailing-comma-add-cl…
Browse files Browse the repository at this point in the history
…osing-brace

fix: remove trailing comma, add closing brace
  • Loading branch information
samccone committed May 26, 2019
2 parents 64b514e + 2827b80 commit 7bf5be9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/trace-event.ts
Expand Up @@ -125,25 +125,28 @@ export class Tracer extends ReadableStream {
for (const evt of this.events) {
this._push(evt);
}
this._flush();
}
}

_read(_: number) {}

private _pushString(ev: Event) {
var separator = "";
if (!this.firstPush) {
this.push("[");
this.firstPush = true;
} else {
separator = ",\n";
}
this.push(JSON.stringify(ev) + ",\n", "utf8");
this.push(separator + JSON.stringify(ev), "utf8");
}

// TODO Perhaps figure out getting a trailing ']' without ',]' if helpful.
//Tracer.prototype._flush = function _flush() {
// if (!this._objectMode) {
// this.push(']')
// }
//};
private _flush() {
if (!this._objectMode) {
this.push("]");
}
}

public child(fields: Fields) {
return new Tracer({
Expand Down

0 comments on commit 7bf5be9

Please sign in to comment.