@@ -4,18 +4,6 @@ var commands = require('redis-commands');
44var Multi = require ( './multi' ) ;
55var RedisClient = require ( '../' ) . RedisClient ;
66var 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- } ( ) ) ;
197
208var addCommand = function ( command ) {
219 // Some rare Redis commands use special characters in their command name
@@ -61,11 +49,9 @@ var addCommand = function (command) {
6149 if ( commandName !== command ) {
6250 RedisClient . prototype [ commandName . toUpperCase ( ) ] = RedisClient . prototype [ commandName ] = RedisClient . prototype [ command ] ;
6351 }
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+ } ) ;
6955 }
7056
7157 // Do not override existing functions
@@ -108,11 +94,9 @@ var addCommand = function (command) {
10894 if ( commandName !== command ) {
10995 Multi . prototype [ commandName . toUpperCase ( ) ] = Multi . prototype [ commandName ] = Multi . prototype [ command ] ;
11096 }
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+ } ) ;
116100 }
117101} ;
118102
0 commit comments