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

Add tests to make sure no invalid function names get exported

This commit is contained in:
Ruben Bridgewater
2016-06-02 00:52:19 +02:00
parent 1487760ffd
commit 7eaba8c10d
3 changed files with 19 additions and 1 deletions

View File

@@ -21,6 +21,9 @@ var changeFunctionName = (function () {
// that provided a functionality to add new commands to the client
commands.list.forEach(function (command) {
// Some rare Redis commands use special characters in their command name
// Convert those to a underscore to prevent using invalid function names
var commandName = command.replace(/(?:^([0-9])|[^a-zA-Z0-9_$])/g, '_$1');
// Do not override existing functions