Skip to content

Commit ffaaf0f

Browse files
author
Ruben Bridgewater
committed
Add name property to all Redis functions
1 parent 55528d8 commit ffaaf0f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Features
1010
- Updated [redis-parser](https://github.com/NodeRedis/redis-parser) dependency ([changelog](https://github.com/NodeRedis/redis-parser/releases/tag/v.2.0.0))
1111
- The JS parser is from now on the new default as it is a lot faster than the hiredis parser
1212
- This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible.
13+
- Added name property to all Redis functions
1314

1415
Bugfixes
1516

lib/commands.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ commands.list.forEach(function (command) {
4444
}
4545
return this.internal_send_command(command, arr, callback);
4646
};
47+
Object.defineProperty(RedisClient.prototype[command], 'name', {
48+
value: command
49+
});
4750
}
4851

4952
// Do not override existing functions
@@ -82,5 +85,8 @@ commands.list.forEach(function (command) {
8285
this.queue.push([command, arr, callback]);
8386
return this;
8487
};
88+
Object.defineProperty(Multi.prototype[command], 'name', {
89+
value: command
90+
});
8591
}
8692
});

lib/individualCommands.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function quit_callback (self, callback) {
9696
};
9797
}
9898

99-
RedisClient.prototype.QUIT = RedisClient.prototype.quit = function (callback) {
99+
RedisClient.prototype.QUIT = RedisClient.prototype.quit = function quit (callback) {
100100
// TODO: Consider this for v.3
101101
// Allow the quit command to be fired as soon as possible to prevent it landing in the offline queue.
102102
// this.ready = this.offline_queue.length === 0;
@@ -108,7 +108,7 @@ RedisClient.prototype.QUIT = RedisClient.prototype.quit = function (callback) {
108108
};
109109

110110
// Only works with batch, not in a transaction
111-
Multi.prototype.QUIT = Multi.prototype.quit = function (callback) {
111+
Multi.prototype.QUIT = Multi.prototype.quit = function quit (callback) {
112112
var self = this._client;
113113
var call_on_write = function () {
114114
// If called in a multi context, we expect redis is available

0 commit comments

Comments
 (0)