Skip to content

Commit

Permalink
fix closure es5/umd toString() iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Jan 27, 2018
1 parent 3d5240a commit fe300df
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ export class TableToStringIterator implements IterableIterator<string> {
pipe(stream: NodeJS.WritableStream) {
let res: IteratorResult<string>;
let write = () => {
if (stream.writable) {
if (stream['writable']) {
do {
if ((res = this.next()).done) { break; }
} while (stream.write(res.value + '\n', 'utf8'));
} while (stream['write'](res.value + '\n', 'utf8'));
}
if (!res || !res.done) {
stream.once('drain', write);
} else if (!(stream as any).isTTY) {
stream.end('\n');
stream['once']('drain', write);
} else if (!(stream as any)['isTTY']) {
stream['end']('\n');
}
};
write();
Expand All @@ -324,7 +324,7 @@ function* tableRowsToString(table: Table, separator = ' | ') {
}
}
yield header.map((x, j) => leftPad(x, ' ', maxColumnWidths[j])).join(separator);
for (let i = -1, n = table.length; ++i < n;) {
for (let i = -1; ++i < table.length;) {
yield [i, ...table.get(i)]
.map((x) => stringify(x))
.map((x, j) => leftPad(x, ' ', maxColumnWidths[j]))
Expand Down

0 comments on commit fe300df

Please sign in to comment.