ioredis-mock
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -129,3 +129,6 @@ "use strict"; | ||
}) { | ||
this[command] = (0, _command.default)(customCommand(numberOfKeys, luaCode).bind(this), command, this); | ||
const cmd = (0, _command.default)(customCommand(numberOfKeys, luaCode).bind(this), command, this); | ||
this[command] = cmd; // for multi/pipeline | ||
this.customCommands[command] = cmd; | ||
} |
@@ -54,3 +54,4 @@ "use strict"; | ||
this.connected = false; | ||
this.subscriberMode = false; // eslint-disable-next-line prefer-object-spread | ||
this.subscriberMode = false; | ||
this.customCommands = {}; // eslint-disable-next-line prefer-object-spread | ||
@@ -57,0 +58,0 @@ const optionsWithDefault = Object.assign({}, defaultOptions, options); |
@@ -27,8 +27,18 @@ "use strict"; | ||
this._transactions = 0; | ||
Object.keys(commands).forEach(command => { | ||
this[command] = this._createCommand(command); | ||
this.copyCommands(); | ||
} | ||
copyCommands() { | ||
Object.keys(commands).forEach(commandName => { | ||
const command = commands[commandName]; | ||
this[commandName] = this._createCommand(commandName, command); | ||
}); // make sure we support custom commands, too | ||
Object.keys(this.redis.customCommands).forEach(commandName => { | ||
const command = this.redis.customCommands[commandName]; | ||
this[commandName] = this._createCommand(commandName, command); | ||
}); | ||
} | ||
_createCommand(commandName) { | ||
_createCommand(commandName, command) { | ||
return (...args) => { | ||
@@ -45,3 +55,3 @@ const lastArgIndex = args.length - 1; | ||
const commandEmulator = commands[commandName].bind(this.redis); | ||
const commandEmulator = command.bind(this.redis); | ||
const commandArgs = (0, _command.processArguments)(args, commandName, this.redis); | ||
@@ -48,0 +58,0 @@ |
@@ -55,3 +55,3 @@ { | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
@@ -129,3 +129,3 @@ "eslint-plugin-jest": "^24.1.3", | ||
"runkitExampleFilename": "example.js", | ||
"version": "5.2.0" | ||
"version": "5.2.1" | ||
} |
178024
4686