From a366b80c63a3a0709cde2ea2bc239edc19e3ac34 Mon Sep 17 00:00:00 2001 From: Andy Bitz Date: Thu, 27 Sep 2018 19:14:21 +0200 Subject: [PATCH] Don't call source() if it is cached --- lib/CachedSource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CachedSource.js b/lib/CachedSource.js index df02706..08ca510 100644 --- a/lib/CachedSource.js +++ b/lib/CachedSource.js @@ -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();