From 0522b268ba47f58101c080b9a60153e3a9db14b9 Mon Sep 17 00:00:00 2001 From: Behrad Date: Fri, 22 Apr 2016 13:46:44 +0430 Subject: [PATCH] updated from #449 --- lib/persistence/abstract.js | 16 ---------------- lib/persistence/levelup.js | 2 +- lib/persistence/redis.js | 2 +- package.json | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/lib/persistence/abstract.js b/lib/persistence/abstract.js index b833773..c0c0060 100644 --- a/lib/persistence/abstract.js +++ b/lib/persistence/abstract.js @@ -138,22 +138,6 @@ AbstractPersistence.prototype.wire = function(server) { }; }; -function arrayFrom(object) { - return [].slice.call(object); -} - -/** - * Array.from polyfill - * @param aSet the set to changed to an array - */ -AbstractPersistence.prototype.arrayFrom = function(aSet) { - if (Array.from) { - return Array.from(aSet); - } else { - return arrayFrom(aSet); - } -}; - /** * Close the persistance. * diff --git a/lib/persistence/levelup.js b/lib/persistence/levelup.js index d557b18..2456efd 100644 --- a/lib/persistence/levelup.js +++ b/lib/persistence/levelup.js @@ -230,7 +230,7 @@ LevelUpPersistence.prototype.lookupSubscriptions = function(client, done) { LevelUpPersistence.prototype.storeOfflinePacket = function(packet, done) { var that = this; var subs = this._subMatcher.match(packet.topic); - async.each(this.arrayFrom(subs), function(key, cb) { + async.each(subs, function(key, cb) { that._subscriptions.get(key, function(err, sub) { if (err) { return cb(err); diff --git a/lib/persistence/redis.js b/lib/persistence/redis.js index 75fd3bd..852b67b 100644 --- a/lib/persistence/redis.js +++ b/lib/persistence/redis.js @@ -334,7 +334,7 @@ RedisPersistence.prototype.storeOfflinePacket = function(packet, done) { var that = this; var matches = this._subMatcher.match(packet.topic); - async.each(this.arrayFrom(matches), function(client, cb) { + async.each(matches, function(client, cb) { that._storePacket(client, packet, cb); }, done); }; diff --git a/package.json b/package.json index 333d205..aa731dc 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ }, "dependencies": { "ascoltatori": "^2.0.0", - "async": "~1.5.2", + "async": "^2.0.0-rc.3", "brfs": "~1.4.2", "bunyan": "^1.5.1", "clone": "^1.0.2",