diff --git a/lib/commands.js b/lib/commands.js index 0082330471..a64773ebf6 100644 --- a/lib/commands.js +++ b/lib/commands.js @@ -21,6 +21,7 @@ var changeFunctionName = (function () { // that provided a functionality to add new commands to the client commands.list.forEach(function (command) { + var commandName = command.replace(/(?:^([0-9])|[^a-zA-Z0-9_$])/g, '_$1'); // Do not override existing functions if (!RedisClient.prototype[command]) { @@ -59,7 +60,7 @@ commands.list.forEach(function (command) { }; if (changeFunctionName) { Object.defineProperty(RedisClient.prototype[command], 'name', { - value: command + value: commandName }); } } @@ -102,7 +103,7 @@ commands.list.forEach(function (command) { }; if (changeFunctionName) { Object.defineProperty(Multi.prototype[command], 'name', { - value: command + value: commandName }); } }