You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Better util/sys fallback with try/catch instead of version magic.
This commit is contained in:
16
lib/util.js
16
lib/util.js
@@ -1,7 +1,11 @@
|
||||
// Support for very old versions of node. At some point, we should abandon this.
|
||||
var minor = process.versions.node.split('.')[1];
|
||||
if (minor > 2) {
|
||||
module.exports = require("util");
|
||||
} else {
|
||||
module.exports = require("sys");
|
||||
// Support for very old versions of node where the module was called "sys". At some point, we should abandon this.
|
||||
|
||||
var util;
|
||||
|
||||
try {
|
||||
util = require("util");
|
||||
} catch (err) {
|
||||
util = require("sys");
|
||||
}
|
||||
|
||||
module.exports = util;
|
||||
|
Reference in New Issue
Block a user