Skip to content

Commit ef23814

Browse files
author
Ruben Bridgewater
committed
Fix typo in string conversion. Closes #918
1 parent b4e8e79 commit ef23814

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
732732
if (Buffer.isBuffer(args[i])) {
733733
buffer_args = true;
734734
} else if (typeof args[i] !== 'string') {
735-
arg = String(arg);
735+
args[i] = String(args[i]);
736736
// 30000 seemed to be a good value to switch to buffers after testing this with and checking the pros and cons
737737
} else if (args[i].length > 30000) {
738738
big_data = true;
@@ -786,7 +786,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
786786

787787
if (!buffer_args && !big_data) { // Build up a string and send entire command in one write
788788
for (i = 0; i < args.length; i += 1) {
789-
arg = String(args[i]);
789+
arg = args[i];
790790
command_str += '$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n';
791791
}
792792
debug('Send ' + this.address + ' id ' + this.connection_id + ': ' + command_str);
@@ -798,7 +798,6 @@ RedisClient.prototype.send_command = function (command, args, callback) {
798798
for (i = 0; i < args.length; i += 1) {
799799
arg = args[i];
800800
if (!Buffer.isBuffer(arg)) {
801-
arg = String(arg);
802801
this.write('$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n');
803802
} else {
804803
this.write('$' + arg.length + '\r\n');

0 commit comments

Comments
 (0)