You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Move requiring util to a separate file
This commit is contained in:
9
index.js
9
index.js
@@ -1,18 +1,11 @@
|
|||||||
/*global Buffer require exports console setTimeout */
|
/*global Buffer require exports console setTimeout */
|
||||||
|
|
||||||
var net = require("net"),
|
var net = require("net"),
|
||||||
util,
|
util = require("./lib/util").util,
|
||||||
events = require("events"),
|
events = require("events"),
|
||||||
default_port = 6379,
|
default_port = 6379,
|
||||||
default_host = "127.0.0.1";
|
default_host = "127.0.0.1";
|
||||||
|
|
||||||
// hilarious 0.2.x to 0.3.x API change
|
|
||||||
try {
|
|
||||||
util = require("util");
|
|
||||||
} catch (err) {
|
|
||||||
util = require("sys");
|
|
||||||
}
|
|
||||||
|
|
||||||
// can can set this to true to enable for all connections
|
// can can set this to true to enable for all connections
|
||||||
exports.debug_mode = false;
|
exports.debug_mode = false;
|
||||||
|
|
||||||
|
7
lib/util.js
Normal file
7
lib/util.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if (process.versions.node.match(/^0.3/)) {
|
||||||
|
exports.util = require("util");
|
||||||
|
} else {
|
||||||
|
/* This module is called "sys" in 0.2.x */
|
||||||
|
exports.util = require("sys");
|
||||||
|
}
|
||||||
|
|
8
test.js
8
test.js
@@ -4,19 +4,13 @@ var redis = require("./index"),
|
|||||||
client2 = redis.createClient(),
|
client2 = redis.createClient(),
|
||||||
client3 = redis.createClient(),
|
client3 = redis.createClient(),
|
||||||
assert = require("assert"),
|
assert = require("assert"),
|
||||||
util,
|
util = require("./lib/util").util,
|
||||||
test_db_num = 15, // this DB will be flushed and used for testing
|
test_db_num = 15, // this DB will be flushed and used for testing
|
||||||
tests = {},
|
tests = {},
|
||||||
connected = false,
|
connected = false,
|
||||||
ended = false,
|
ended = false,
|
||||||
server_info;
|
server_info;
|
||||||
|
|
||||||
try {
|
|
||||||
util = require("util");
|
|
||||||
} catch (err) {
|
|
||||||
util = require("sys");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uncomment this to see the wire protocol and other debugging info
|
// Uncomment this to see the wire protocol and other debugging info
|
||||||
//redis.debug_mode = true;
|
//redis.debug_mode = true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user