From 87ce4e558303a324566c4d5c2495681f37cec5e8 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 13 Jun 2016 02:43:19 -0700 Subject: [PATCH] remove delete calls. --- lib/bcoin/bst.js | 10 +++++----- lib/bcoin/memblock.js | 2 +- lib/bcoin/pool.js | 10 ++++++---- lib/bcoin/reader.js | 6 +++--- lib/bcoin/script.js | 2 +- lib/bcoin/writer.js | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/bcoin/bst.js b/lib/bcoin/bst.js index 87bdc478..b8fb524d 100644 --- a/lib/bcoin/bst.js +++ b/lib/bcoin/bst.js @@ -583,9 +583,9 @@ Batch.prototype.write = function write(callback) { }); this.ops.length = 0; - delete this.ops; - delete this.options; - delete this.tree; + this.ops = null; + this.options = null; + this.tree = null; utils.nextTick(callback); @@ -691,9 +691,9 @@ Iterator.prototype._end = function end() { if (!this.tree) return; - delete this.tree; + this.tree = null; this.items.length = 0; - delete this.items; + this.items = null; }; Iterator.prototype.end = function end(callback) { diff --git a/lib/bcoin/memblock.js b/lib/bcoin/memblock.js index 7e3911d1..e87fe6cb 100644 --- a/lib/bcoin/memblock.js +++ b/lib/bcoin/memblock.js @@ -100,7 +100,7 @@ MemBlock.prototype.getCoinbaseHeight = function getCoinbaseHeight() { MemBlock.prototype.toBlock = function toBlock() { var data = bcoin.protocol.parser.parseBlock(this.raw); - delete this.raw; + this.raw = null; return new bcoin.block(data); }; diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 7a80a79d..31e27a29 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -133,6 +133,8 @@ function Pool(options) { this.synced = false; this._scheduled = false; this._pendingWatch = null; + this._timer = null; + this._interval = null; this.load = { timeout: options.loadTimeout || 120000, @@ -436,11 +438,11 @@ Pool.prototype._startTimer = function _startTimer() { }; Pool.prototype._stopTimer = function _stopTimer() { - if (!this._timer) + if (this._timer == null) return; clearTimeout(this._timer); - delete this._timer; + this._timer = null; }; Pool.prototype._startInterval = function _startInterval() { @@ -466,11 +468,11 @@ Pool.prototype._startInterval = function _startInterval() { }; Pool.prototype._stopInterval = function _stopInterval() { - if (!this._interval) + if (this._interval == null) return; clearInterval(this._interval); - delete this._interval; + this._interval = null; }; Pool.prototype._addLoader = function _addLoader() { diff --git a/lib/bcoin/reader.js b/lib/bcoin/reader.js index fadd07cc..8781c399 100644 --- a/lib/bcoin/reader.js +++ b/lib/bcoin/reader.js @@ -128,9 +128,9 @@ BufferReader.prototype.endData = function endData(zeroCopy) { */ BufferReader.prototype.destroy = function destroy() { - delete this.offset; - delete this.stack; - delete this.data; + this.offset = null; + this.stack = null; + this.data = null; }; /** diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 06e8858b..d263f66e 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -1974,7 +1974,7 @@ Script.prototype.removeData = function removeData(data) { this.code.splice(index[i], 1); if (this.raw) { - delete this.raw; + this.raw = null; this.encode(); } diff --git a/lib/bcoin/writer.js b/lib/bcoin/writer.js index 16dc46cc..58f390bc 100644 --- a/lib/bcoin/writer.js +++ b/lib/bcoin/writer.js @@ -148,8 +148,8 @@ BufferWriter.prototype.seek = function seek(offset) { BufferWriter.prototype.destroy = function destroy() { this.data.length = 0; - delete this.data; - delete this.written; + this.data = null; + this.written = null; }; /**