From eb4a8f1c9e54056ee00e58d7dfb8b08745d4f52e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 6 Apr 2023 16:21:30 -0400 Subject: [PATCH] Revert "*Change pullRemote to throw if the item is not empty" This reverts commit 74b0f1d596e18ff5e1a152849d1d1dbc3d1538c3. --- index.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 6c840fd..41139a2 100644 --- a/index.js +++ b/index.js @@ -777,15 +777,12 @@ module.exports = class Protomux { async popFree(id) { await this.userData.syncProtomux("popFree", id); } - async pushFree(id) { await this.userData.syncProtomux("pushFree", id); } - async pushLocal(id) { await this.userData.syncProtomux("pushLocal", id); } - async pushRemote(id) { await this.userData.syncProtomux("pushRemote", id); } @@ -800,23 +797,20 @@ module.exports = class Protomux { } }); } - async pullFree() { const ids = await this.userData.syncProtomux("pullFree"); this._free = Array.from(new Set([...this._free, ...ids])); this._free = this._free.filter((item) => item !== null); } - async pullRemote() { const ids = await this.userData.syncProtomux("pullRemote"); ids.forEach((item) => { item = parseInt(item); - if (typeof this._remote[item] !== "undefined") { - throw new Error("empty remote element expected"); + if (typeof this._remote[item] === "undefined") { + this._remote[item] = null; } - this._remote[item] = null; }); } };