@@ -4,18 +4,6 @@ var commands = require('redis-commands');
4
4
var Multi = require ( './multi' ) ;
5
5
var RedisClient = require ( '../' ) . RedisClient ;
6
6
var Command = require ( './command' ) ;
7
- // Feature detect if a function may change it's name
8
- var changeFunctionName = ( function ( ) {
9
- var fn = function abc ( ) { } ;
10
- try {
11
- Object . defineProperty ( fn , 'name' , {
12
- value : 'foobar'
13
- } ) ;
14
- return true ;
15
- } catch ( e ) {
16
- return false ;
17
- }
18
- } ( ) ) ;
19
7
20
8
var addCommand = function ( command ) {
21
9
// Some rare Redis commands use special characters in their command name
@@ -61,11 +49,9 @@ var addCommand = function (command) {
61
49
if ( commandName !== command ) {
62
50
RedisClient . prototype [ commandName . toUpperCase ( ) ] = RedisClient . prototype [ commandName ] = RedisClient . prototype [ command ] ;
63
51
}
64
- if ( changeFunctionName ) {
65
- Object . defineProperty ( RedisClient . prototype [ command ] , 'name' , {
66
- value : commandName
67
- } ) ;
68
- }
52
+ Object . defineProperty ( RedisClient . prototype [ command ] , 'name' , {
53
+ value : commandName
54
+ } ) ;
69
55
}
70
56
71
57
// Do not override existing functions
@@ -108,11 +94,9 @@ var addCommand = function (command) {
108
94
if ( commandName !== command ) {
109
95
Multi . prototype [ commandName . toUpperCase ( ) ] = Multi . prototype [ commandName ] = Multi . prototype [ command ] ;
110
96
}
111
- if ( changeFunctionName ) {
112
- Object . defineProperty ( Multi . prototype [ command ] , 'name' , {
113
- value : commandName
114
- } ) ;
115
- }
97
+ Object . defineProperty ( Multi . prototype [ command ] , 'name' , {
98
+ value : commandName
99
+ } ) ;
116
100
}
117
101
} ;
118
102
0 commit comments