You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
feat: return channel number and channels from subscribe / unsubscribe calls
This commit is contained in:
@@ -130,6 +130,31 @@ module.exports = {
|
||||
};
|
||||
}
|
||||
},
|
||||
isUnSubscribe: function (count, channels, done) {
|
||||
if (typeof count !== 'number') {
|
||||
done = channels;
|
||||
channels = count;
|
||||
count = undefined;
|
||||
}
|
||||
if (typeof channels === 'function') {
|
||||
done = count;
|
||||
count = undefined;
|
||||
}
|
||||
if (typeof channels === 'string') {
|
||||
channels = [channels];
|
||||
}
|
||||
var len = channels.length;
|
||||
return function (err, results) {
|
||||
assert.strictEqual(err, null, 'expected an array, got: ' + err);
|
||||
assert.strictEqual(Array.isArray(results), true, results);
|
||||
assert.strictEqual(Array.isArray(results[1]), true, results);
|
||||
assert.strictEqual(results[1].length, len, results);
|
||||
assert.strictEqual(typeof results[0], 'number', results);
|
||||
if (count) assert.strictEqual(count, results[0], results);
|
||||
if (done) done();
|
||||
};
|
||||
|
||||
},
|
||||
match: function (pattern, done) {
|
||||
return function (err, results) {
|
||||
assert.strictEqual(err, null, 'expected ' + pattern.toString() + ', got error: ' + err);
|
||||
|
Reference in New Issue
Block a user