Skip to content

Commit

Permalink
perf: No longer pushes empty strings onto internal array.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 20, 2019
1 parent 8e26c5f commit 4d46a72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/code-block-writer.ts
Expand Up @@ -682,6 +682,9 @@ export default class CodeBlockWriter {

/** @internal */
private _internalWrite(text: string) {
if (text.length === 0)
return;

this._texts.push(text);
this._length += text.length;
}
Expand Down

1 comment on commit 4d46a72

@dsherret
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #28.

Please sign in to comment.