Skip to content

Commit

Permalink
Don't call source() if it is cached
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyBitz committed Sep 27, 2018
1 parent a829b0f commit a366b80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/CachedSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CachedSource extends Source {
size() {
if(typeof this._cachedSize !== "undefined") return this._cachedSize;
if(typeof this._cachedSource !== "undefined") {
if(Buffer.from.length === 1) return new Buffer(this.source()).length;
if(Buffer.from.length === 1) return new Buffer(this._cachedSource).length;
return this._cachedSize = Buffer.byteLength(this._cachedSource);
}
return this._cachedSize = this._source.size();
Expand Down

0 comments on commit a366b80

Please sign in to comment.