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

chore: improve new add_command and add documentation

This commit is contained in:
Ruben Bridgewater
2017-08-01 00:09:19 -03:00
parent 0437aa4985
commit 51fdbb7fc2
5 changed files with 31 additions and 41 deletions

View File

@@ -57,12 +57,12 @@ var addCommand = function (command) {
}
return this.internal_send_command(new Command(command, arr, callback));
};
//alias commands with illegal function names (e.g. NR.RUN becomes NR_RUN and nr_run)
// Alias special function names (e.g. NR.RUN becomes NR_RUN and nr_run)
if (commandName !== command) {
RedisClient.prototype[commandName.toUpperCase()] = RedisClient.prototype[commandName] = RedisClient.prototype[command];
}
if (changeFunctionName) {
Object.defineProperty(RedisClient.prototype[commandName], 'name', {
Object.defineProperty(RedisClient.prototype[command], 'name', {
value: commandName
});
}
@@ -104,12 +104,12 @@ var addCommand = function (command) {
this.queue.push(new Command(command, arr, callback));
return this;
};
//alias commands with illegal function names (e.g. NR.RUN becomes NR_RUN and nr_run)
// Alias special function names (e.g. NR.RUN becomes NR_RUN and nr_run)
if (commandName !== command) {
Multi.prototype[commandName.toUpperCase()] = Multi.prototype[commandName] = Multi.prototype[command];
}
if (changeFunctionName) {
Object.defineProperty(Multi.prototype[commandName], 'name', {
Object.defineProperty(Multi.prototype[command], 'name', {
value: commandName
});
}