Socket
Socket
Sign inDemoInstall

redis-mock

Package Overview
Dependencies
0
Maintainers
3
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.55.1 to 0.56.0

lib/client/argParsers.js

34

lib/helpers.js

@@ -25,3 +25,3 @@ const charMap = {

exports.patternToRegex = function(pattern) {
var fixed = pattern.replace(patternChanger, function(matched) {
const fixed = pattern.replace(patternChanger, function(matched) {
return charMap[matched]

@@ -36,7 +36,15 @@ });

var mockCallback = exports.mockCallback = function(err, reply) {}; //eslint-disable-line no-empty-function
const callCallback = exports.callCallback = (callback, err, result) => {
if (typeof callback === 'function') {
process.nextTick(() => {
callback(err, result);
});
}
};
var parseCallback = exports.parseCallback = function(args) {
var callback;
var len = args.length;
exports.noOpCallback = function(err, reply) {}; //eslint-disable-line no-empty-function
exports.parseCallback = function(args) {
let callback;
const len = args.length;
if ('function' === typeof args[len - 1]) {

@@ -48,6 +56,6 @@ callback = args[len-1];

var validKeyType = exports.validKeyType = function(mockInstance, key, type, callback) {
exports.validKeyType = function(mockInstance, key, type, callback) {
if (mockInstance.storage[key] && mockInstance.storage[key].type !== type) {
var err = new Error('WRONGTYPE Operation against a key holding the wrong kind of value');
mockInstance._callCallback(callback, err);
const err = new Error('WRONGTYPE Operation against a key holding the wrong kind of value');
callCallback(callback, err);
return false;

@@ -58,8 +66,8 @@ }

var initKey = exports.initKey = function(mockInstance, key, fn) {
exports.initKey = function(mockInstance, key, fn) {
mockInstance.storage[key] = mockInstance.storage[key] || fn();
};
var shuffle = exports.shuffle = function(array) {
var counter = array.length;
exports.shuffle = function(array) {
let counter = array.length;

@@ -69,3 +77,3 @@ // While there are elements in the array

// Pick a random index
var index = Math.floor(Math.random() * counter);
const index = Math.floor(Math.random() * counter);

@@ -76,3 +84,3 @@ // Decrease counter by 1

// And swap the last element with it
var temp = array[counter];
const temp = array[counter];
array[counter] = array[index];

@@ -79,0 +87,0 @@ array[index] = temp;

{
"name": "redis-mock",
"version": "0.55.1",
"version": "0.56.0",
"description": "Redis client mock object for unit testing",
"author": "Kristian Faeldt <kristian.faeldt@gmail.com>",
"main": "./lib/redis-mock",
"main": "./lib/index",
"license": "MIT",

@@ -15,8 +15,8 @@ "repository": {

"mocha": "6.2.3",
"redis": "^3.0.2",
"should": "13.2.3"
"should": "13.2.3",
"redis": "^3.0.2"
},
"scripts": {
"test": "mocha --timeout 5000",
"test:valid": "VALID_TESTS=true mocha --timeout 5000 --exit",
"test": "mocha --timeout 5000 --recursive",
"test:valid": "VALID_TESTS=true npm run test -- --exit",
"lint": "eslint ./lib ./test"

@@ -23,0 +23,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc