1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Add simicolons

This is just a style change
This commit is contained in:
Ruben Bridgewater
2015-07-22 16:19:02 +02:00
parent 1f9e536ca0
commit a2bc597212
8 changed files with 37 additions and 33 deletions

View File

@ -49,7 +49,7 @@ before_lines.forEach(function(b, i) {
var isNaN = !num && num !== 0; var isNaN = !num && num !== 0;
return !isNaN; return !isNaN;
}); });
if (ops.length != 2) return if (ops.length != 2) return;
var delta = ops[1] - ops[0]; var delta = ops[1] - ops[0];
var pct = ((delta / ops[0]) * 100).toPrecision(3); var pct = ((delta / ops[0]) * 100).toPrecision(3);

View File

@ -16,7 +16,7 @@ redis.RedisClient.prototype.parse_info = function (callback) {
obj[parts[0]] = parts[1]; obj[parts[0]] = parts[1];
} }
}); });
callback(obj) callback(obj);
}); });
}; };

View File

@ -13,7 +13,7 @@ var redis = require("redis"),
// Read a file from fs, store it in Redis, get it back from Redis, write it back to fs. // Read a file from fs, store it in Redis, get it back from Redis, write it back to fs.
fs.readFile(filename, function (err, data) { fs.readFile(filename, function (err, data) {
if (err) throw err if (err) throw err;
console.log("Read " + data.length + " bytes from filesystem."); console.log("Read " + data.length + " bytes from filesystem.");
client.set(filename, data, redis.print); // set entire file client.set(filename, data, redis.print); // set entire file
@ -23,7 +23,7 @@ fs.readFile(filename, function (err, data) {
} else { } else {
fs.writeFile("duplicate_" + filename, reply, function (err) { fs.writeFile("duplicate_" + filename, reply, function (err) {
if (err) { if (err) {
console.log("Error on write: " + err) console.log("Error on write: " + err);
} else { } else {
console.log("File written."); console.log("File written.");
} }

View File

@ -1,9 +1,11 @@
'use strict';
var redis = require("redis"), var redis = require("redis"),
client = redis.createClient("/tmp/redis.sock"), client = redis.createClient("/tmp/redis.sock"),
profiler = require("v8-profiler"); profiler = require("v8-profiler");
client.on("connect", function () { client.on("connect", function () {
console.log("Got Unix socket connection.") console.log("Got Unix socket connection.");
}); });
client.on("error", function (err) { client.on("error", function (err) {

View File

@ -17,10 +17,10 @@ var net = require("net"),
// can set this to true to enable for all connections // can set this to true to enable for all connections
exports.debug_mode = false; exports.debug_mode = false;
var arraySlice = Array.prototype.slice var arraySlice = Array.prototype.slice;
function trace() { function trace() {
if (!exports.debug_mode) return; if (!exports.debug_mode) return;
console.log.apply(null, arraySlice.call(arguments)) console.log.apply(null, arraySlice.call(arguments));
} }
// hiredis might not be installed // hiredis might not be installed
@ -141,7 +141,7 @@ RedisClient.prototype.unref = function () {
trace("Not connected yet, will unref later"); trace("Not connected yet, will unref later");
this.once("connect", function () { this.once("connect", function () {
this.unref(); this.unref();
}) });
} }
}; };
@ -219,7 +219,7 @@ RedisClient.prototype.do_auth = function () {
}, 2000); // TODO - magic number alert }, 2000); // TODO - magic number alert
return; return;
} else if (err.toString().match("no password is set")) { } else if (err.toString().match("no password is set")) {
console.log("Warning: Redis server does not require a password, but a password was supplied.") console.log("Warning: Redis server does not require a password, but a password was supplied.");
err = null; err = null;
res = "OK"; res = "OK";
} else { } else {
@ -1265,7 +1265,7 @@ var createClient_unix = function(path, options){
redis_client.address = path; redis_client.address = path;
return redis_client; return redis_client;
} };
var createClient_tcp = function (port_arg, host_arg, options) { var createClient_tcp = function (port_arg, host_arg, options) {
var cnxOptions = { var cnxOptions = {

View File

@ -11,12 +11,12 @@ module.exports = function (tests, next) {
q.push(3); q.push(3);
assert.equal(q.length, 2); assert.equal(q.length, 2);
return next(); return next();
} };
tests.shift = function () { tests.shift = function () {
assert.equal(q.shift(), 'a'); assert.equal(q.shift(), 'a');
return next(); return next();
} };
tests.forEach = function () { tests.forEach = function () {
q.forEach(function (v) { q.forEach(function (v) {
@ -24,7 +24,7 @@ module.exports = function (tests, next) {
}); });
return next(); return next();
} };
tests.forEachWithScope = function () { tests.forEachWithScope = function () {
q.forEach(function (v) { q.forEach(function (v) {
@ -33,5 +33,5 @@ module.exports = function (tests, next) {
}, {foo: 'bar'}); }, {foo: 'bar'});
return next(); return next();
} };
} };

View File

@ -1,12 +1,14 @@
var redis = require("../") 'use strict';
var redis = require("../");
//redis.debug_mode = true //redis.debug_mode = true
var PORT = process.argv[2] || 6379; var PORT = process.argv[2] || 6379;
var HOST = process.argv[3] || '127.0.0.1'; var HOST = process.argv[3] || '127.0.0.1';
var c = redis.createClient(PORT, HOST) var c = redis.createClient(PORT, HOST);
c.unref() c.unref();
c.info(function (err, reply) { c.info(function (err, reply) {
if (err) process.exit(-1) if (err) process.exit(-1);
if (!reply.length) process.exit(-1) if (!reply.length) process.exit(-1);
process.stdout.write(reply.length.toString()) process.stdout.write(reply.length.toString());
}) });

View File

@ -137,7 +137,7 @@ tests.IPV4 = function () {
console.error("client: " + err.stack); console.error("client: " + err.stack);
process.exit(); process.exit();
}); });
} };
tests.IPV6 = function () { tests.IPV6 = function () {
if (!server_version_at_least(client, [2, 8, 0])) { if (!server_version_at_least(client, [2, 8, 0])) {
@ -163,7 +163,7 @@ tests.IPV6 = function () {
console.error("client: " + err.stack); console.error("client: " + err.stack);
process.exit(); process.exit();
}); });
} };
tests.UNIX_SOCKET = function () { tests.UNIX_SOCKET = function () {
var unixClient = redis.createClient('/tmp/redis.sock', { parser: parser }); var unixClient = redis.createClient('/tmp/redis.sock', { parser: parser });
@ -189,7 +189,7 @@ tests.UNIX_SOCKET = function () {
console.error("client: " + err.stack); console.error("client: " + err.stack);
process.exit(); process.exit();
}); });
} };
tests.FLUSHDB = function () { tests.FLUSHDB = function () {
var name = "FLUSHDB"; var name = "FLUSHDB";
@ -1543,7 +1543,7 @@ tests.HGETALL_MESSAGE = function () {
client.hgetall("msg_test", function (err, obj) { client.hgetall("msg_test", function (err, obj) {
assert.strictEqual(null, err, name + " result sent back unexpected error: " + err); assert.strictEqual(null, err, name + " result sent back unexpected error: " + err);
assert.strictEqual(1, Object.keys(obj).length, name); assert.strictEqual(1, Object.keys(obj).length, name);
assert.strictEqual(obj.message, "hello") assert.strictEqual(obj.message, "hello");
next(name); next(name);
}); });
}; };
@ -2178,8 +2178,8 @@ tests.ENABLE_OFFLINE_QUEUE_FALSE = function () {
// ignore, see above // ignore, see above
}); });
assert.throws(function () { assert.throws(function () {
cli.set(name, name) cli.set(name, name);
}) });
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
cli.set(name, name, function (err) { cli.set(name, name, function (err) {
// should callback with an error // should callback with an error
@ -2205,7 +2205,7 @@ tests.SLOWLOG = function () {
client.config("set", "slowlog-log-slower-than", 10000, require_string("OK", name)); client.config("set", "slowlog-log-slower-than", 10000, require_string("OK", name));
next(name); next(name);
}); });
} };
tests.DOMAIN = function () { tests.DOMAIN = function () {
var name = "DOMAIN"; var name = "DOMAIN";
@ -2323,9 +2323,9 @@ tests.unref = function () {
var external = fork("./test/test-unref.js"); var external = fork("./test/test-unref.js");
var done = false; var done = false;
external.on("close", function (code) { external.on("close", function (code) {
assert(code == 0, "test-unref.js failed"); assert(code === 0, "test-unref.js failed");
done = true; done = true;
}) });
setTimeout(function () { setTimeout(function () {
if (!done) { if (!done) {
external.kill(); external.kill();
@ -2336,7 +2336,7 @@ tests.unref = function () {
}; };
// starting to split tests into multiple files. // starting to split tests into multiple files.
require('./queue-test')(tests, next) require('./queue-test')(tests, next);
all_tests = Object.keys(tests); all_tests = Object.keys(tests);
all_start = new Date(); all_start = new Date();