mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
Fix space-before-function-paren linter rule
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(redisClient, module) {
|
||||
module.exports = function (redisClient, module) {
|
||||
|
||||
var helpers = module.helpers.redis;
|
||||
|
||||
module.sortedSetAdd = function(key, score, value, callback) {
|
||||
callback = callback || function() {};
|
||||
module.sortedSetAdd = function (key, score, value, callback) {
|
||||
callback = callback || function () {};
|
||||
if (Array.isArray(score) && Array.isArray(value)) {
|
||||
return sortedSetAddMulti(key, score, value, callback);
|
||||
}
|
||||
redisClient.zadd(key, score, value, function(err) {
|
||||
redisClient.zadd(key, score, value, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
@@ -29,65 +29,65 @@ module.exports = function(redisClient, module) {
|
||||
args.push(scores[i], values[i]);
|
||||
}
|
||||
|
||||
redisClient.zadd(args, function(err) {
|
||||
redisClient.zadd(args, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
||||
module.sortedSetsAdd = function(keys, score, value, callback) {
|
||||
callback = callback || function() {};
|
||||
module.sortedSetsAdd = function (keys, score, value, callback) {
|
||||
callback = callback || function () {};
|
||||
var multi = redisClient.multi();
|
||||
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
multi.zadd(keys[i], score, value);
|
||||
}
|
||||
|
||||
multi.exec(function(err) {
|
||||
multi.exec(function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.sortedSetRemove = function(key, value, callback) {
|
||||
callback = callback || function() {};
|
||||
module.sortedSetRemove = function (key, value, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!Array.isArray(value)) {
|
||||
value = [value];
|
||||
}
|
||||
|
||||
helpers.multiKeyValues(redisClient, 'zrem', key, value, function(err) {
|
||||
helpers.multiKeyValues(redisClient, 'zrem', key, value, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.sortedSetsRemove = function(keys, value, callback) {
|
||||
helpers.multiKeysValue(redisClient, 'zrem', keys, value, function(err) {
|
||||
module.sortedSetsRemove = function (keys, value, callback) {
|
||||
helpers.multiKeysValue(redisClient, 'zrem', keys, value, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.sortedSetsRemoveRangeByScore = function(keys, min, max, callback) {
|
||||
callback = callback || function() {};
|
||||
module.sortedSetsRemoveRangeByScore = function (keys, min, max, callback) {
|
||||
callback = callback || function () {};
|
||||
var multi = redisClient.multi();
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
multi.zremrangebyscore(keys[i], min, max);
|
||||
}
|
||||
multi.exec(function(err) {
|
||||
multi.exec(function (err) {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
|
||||
module.getSortedSetRange = function(key, start, stop, callback) {
|
||||
module.getSortedSetRange = function (key, start, stop, callback) {
|
||||
sortedSetRange('zrange', key, start, stop, false, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevRange = function(key, start, stop, callback) {
|
||||
module.getSortedSetRevRange = function (key, start, stop, callback) {
|
||||
sortedSetRange('zrevrange', key, start, stop, false, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRangeWithScores = function(key, start, stop, callback) {
|
||||
module.getSortedSetRangeWithScores = function (key, start, stop, callback) {
|
||||
sortedSetRange('zrange', key, start, stop, true, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevRangeWithScores = function(key, start, stop, callback) {
|
||||
module.getSortedSetRevRangeWithScores = function (key, start, stop, callback) {
|
||||
sortedSetRange('zrevrange', key, start, stop, true, callback);
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ module.exports = function(redisClient, module) {
|
||||
params.push('WITHSCORES');
|
||||
}
|
||||
|
||||
redisClient[method](params, function(err, data) {
|
||||
redisClient[method](params, function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -116,24 +116,24 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
}
|
||||
|
||||
module.getSortedSetRangeByScore = function(key, start, count, min, max, callback) {
|
||||
module.getSortedSetRangeByScore = function (key, start, count, min, max, callback) {
|
||||
redisClient.zrangebyscore([key, min, max, 'LIMIT', start, count], callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevRangeByScore = function(key, start, count, max, min, callback) {
|
||||
module.getSortedSetRevRangeByScore = function (key, start, count, max, min, callback) {
|
||||
redisClient.zrevrangebyscore([key, max, min, 'LIMIT', start, count], callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRangeByScoreWithScores = function(key, start, count, min, max, callback) {
|
||||
module.getSortedSetRangeByScoreWithScores = function (key, start, count, min, max, callback) {
|
||||
sortedSetRangeByScoreWithScores('zrangebyscore', key, start, count, min, max, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevRangeByScoreWithScores = function(key, start, count, max, min, callback) {
|
||||
module.getSortedSetRevRangeByScoreWithScores = function (key, start, count, max, min, callback) {
|
||||
sortedSetRangeByScoreWithScores('zrevrangebyscore', key, start, count, max, min, callback);
|
||||
};
|
||||
|
||||
function sortedSetRangeByScoreWithScores(method, key, start, count, min, max, callback) {
|
||||
redisClient[method]([key, min, max, 'WITHSCORES', 'LIMIT', start, count], function(err, data) {
|
||||
redisClient[method]([key, min, max, 'WITHSCORES', 'LIMIT', start, count], function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -145,15 +145,15 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
}
|
||||
|
||||
module.sortedSetCount = function(key, min, max, callback) {
|
||||
module.sortedSetCount = function (key, min, max, callback) {
|
||||
redisClient.zcount(key, min, max, callback);
|
||||
};
|
||||
|
||||
module.sortedSetCard = function(key, callback) {
|
||||
module.sortedSetCard = function (key, callback) {
|
||||
redisClient.zcard(key, callback);
|
||||
};
|
||||
|
||||
module.sortedSetsCard = function(keys, callback) {
|
||||
module.sortedSetsCard = function (keys, callback) {
|
||||
if (Array.isArray(keys) && !keys.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
@@ -164,11 +164,11 @@ module.exports = function(redisClient, module) {
|
||||
multi.exec(callback);
|
||||
};
|
||||
|
||||
module.sortedSetRank = function(key, value, callback) {
|
||||
module.sortedSetRank = function (key, value, callback) {
|
||||
redisClient.zrank(key, value, callback);
|
||||
};
|
||||
|
||||
module.sortedSetsRanks = function(keys, values, callback) {
|
||||
module.sortedSetsRanks = function (keys, values, callback) {
|
||||
var multi = redisClient.multi();
|
||||
for(var i = 0; i < values.length; ++i) {
|
||||
multi.zrank(keys[i], values[i]);
|
||||
@@ -176,7 +176,7 @@ module.exports = function(redisClient, module) {
|
||||
multi.exec(callback);
|
||||
};
|
||||
|
||||
module.sortedSetRanks = function(key, values, callback) {
|
||||
module.sortedSetRanks = function (key, values, callback) {
|
||||
var multi = redisClient.multi();
|
||||
for(var i = 0; i < values.length; ++i) {
|
||||
multi.zrank(key, values[i]);
|
||||
@@ -184,30 +184,30 @@ module.exports = function(redisClient, module) {
|
||||
multi.exec(callback);
|
||||
};
|
||||
|
||||
module.sortedSetRevRank = function(key, value, callback) {
|
||||
module.sortedSetRevRank = function (key, value, callback) {
|
||||
redisClient.zrevrank(key, value, callback);
|
||||
};
|
||||
|
||||
module.sortedSetScore = function(key, value, callback) {
|
||||
module.sortedSetScore = function (key, value, callback) {
|
||||
redisClient.zscore(key, value, callback);
|
||||
};
|
||||
|
||||
module.sortedSetsScore = function(keys, value, callback) {
|
||||
module.sortedSetsScore = function (keys, value, callback) {
|
||||
helpers.multiKeysValue(redisClient, 'zscore', keys, value, callback);
|
||||
};
|
||||
|
||||
module.sortedSetScores = function(key, values, callback) {
|
||||
module.sortedSetScores = function (key, values, callback) {
|
||||
helpers.multiKeyValues(redisClient, 'zscore', key, values, callback);
|
||||
};
|
||||
|
||||
module.isSortedSetMember = function(key, value, callback) {
|
||||
module.sortedSetScore(key, value, function(err, score) {
|
||||
module.isSortedSetMember = function (key, value, callback) {
|
||||
module.sortedSetScore(key, value, function (err, score) {
|
||||
callback(err, !!score);
|
||||
});
|
||||
};
|
||||
|
||||
module.isSortedSetMembers = function(key, values, callback) {
|
||||
helpers.multiKeyValues(redisClient, 'zscore', key, values, function(err, results) {
|
||||
module.isSortedSetMembers = function (key, values, callback) {
|
||||
helpers.multiKeyValues(redisClient, 'zscore', key, values, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -215,8 +215,8 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.isMemberOfSortedSets = function(keys, value, callback) {
|
||||
helpers.multiKeysValue(redisClient, 'zscore', keys, value, function(err, results) {
|
||||
module.isMemberOfSortedSets = function (keys, value, callback) {
|
||||
helpers.multiKeysValue(redisClient, 'zscore', keys, value, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.getSortedSetsMembers = function(keys, callback) {
|
||||
module.getSortedSetsMembers = function (keys, callback) {
|
||||
var multi = redisClient.multi();
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
multi.zrange(keys[i], 0, -1);
|
||||
@@ -233,14 +233,14 @@ module.exports = function(redisClient, module) {
|
||||
};
|
||||
|
||||
|
||||
module.sortedSetUnionCard = function(keys, callback) {
|
||||
module.sortedSetUnionCard = function (keys, callback) {
|
||||
var tempSetName = 'temp_' + Date.now();
|
||||
|
||||
var multi = redisClient.multi();
|
||||
multi.zunionstore([tempSetName, keys.length].concat(keys));
|
||||
multi.zcard(tempSetName);
|
||||
multi.del(tempSetName);
|
||||
multi.exec(function(err, results) {
|
||||
multi.exec(function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -249,12 +249,12 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.getSortedSetUnion = function(params, callback) {
|
||||
module.getSortedSetUnion = function (params, callback) {
|
||||
params.method = 'zrange';
|
||||
sortedSetUnion(params, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevUnion = function(params, callback) {
|
||||
module.getSortedSetRevUnion = function (params, callback) {
|
||||
params.method = 'zrevrange';
|
||||
sortedSetUnion(params, callback);
|
||||
};
|
||||
@@ -272,7 +272,7 @@ module.exports = function(redisClient, module) {
|
||||
multi.zunionstore([tempSetName, params.sets.length].concat(params.sets));
|
||||
multi[params.method](rangeParams);
|
||||
multi.del(tempSetName);
|
||||
multi.exec(function(err, results) {
|
||||
multi.exec(function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -288,11 +288,11 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
}
|
||||
|
||||
module.sortedSetIncrBy = function(key, increment, value, callback) {
|
||||
module.sortedSetIncrBy = function (key, increment, value, callback) {
|
||||
redisClient.zincrby(key, increment, value, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRangeByLex = function(key, min, max, start, count, callback) {
|
||||
module.getSortedSetRangeByLex = function (key, min, max, start, count, callback) {
|
||||
if (min !== '-') {
|
||||
min = '[' + min;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ module.exports = function(redisClient, module) {
|
||||
redisClient.zrangebylex([key, min, max, 'LIMIT', start, count], callback);
|
||||
};
|
||||
|
||||
module.sortedSetIntersectCard = function(keys, callback) {
|
||||
module.sortedSetIntersectCard = function (keys, callback) {
|
||||
if (!Array.isArray(keys) || !keys.length) {
|
||||
return callback(null, 0);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ module.exports = function(redisClient, module) {
|
||||
multi.zinterstore(interParams);
|
||||
multi.zcard(tempSetName);
|
||||
multi.del(tempSetName);
|
||||
multi.exec(function(err, results) {
|
||||
multi.exec(function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -323,12 +323,12 @@ module.exports = function(redisClient, module) {
|
||||
});
|
||||
};
|
||||
|
||||
module.getSortedSetIntersect = function(params, callback) {
|
||||
module.getSortedSetIntersect = function (params, callback) {
|
||||
params.method = 'zrange';
|
||||
getSortedSetRevIntersect(params, callback);
|
||||
};
|
||||
|
||||
module.getSortedSetRevIntersect = function(params, callback) {
|
||||
module.getSortedSetRevIntersect = function (params, callback) {
|
||||
params.method = 'zrevrange';
|
||||
getSortedSetRevIntersect(params, callback);
|
||||
};
|
||||
@@ -359,7 +359,7 @@ module.exports = function(redisClient, module) {
|
||||
multi.zinterstore(interParams);
|
||||
multi[params.method](rangeParams);
|
||||
multi.del(tempSetName);
|
||||
multi.exec(function(err, results) {
|
||||
multi.exec(function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user