From 8e7c6f170db16b7f2aae2dcbd18661e4beb9eae3 Mon Sep 17 00:00:00 2001 From: luin Date: Sat, 30 Jun 2018 13:34:00 +0800 Subject: [PATCH] fix: Deprecated `Redis()` in favor of `new Redis()` --- lib/redis.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/redis.js b/lib/redis.js index c9cf2c06..08e491d1 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -102,6 +102,11 @@ var PromiseContainer = require('./promise_container'); * ``` */ function Redis() { + if (!(this instanceof Redis)) { + console.error(new Error('Calling `Redis()` like a function is deprecated. Using `new Redis()` instead.').stack.replace('Error', 'Warning')); + return new Redis(arguments[0], arguments[1], arguments[2]); + } + this.parseOptions(arguments[0], arguments[1], arguments[2]); EventEmitter.call(this);