Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

co-redis

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-redis - npm Package Compare versions

Comparing version 0.0.3 to 1.0.0

71

index.js

@@ -1,15 +0,60 @@

module.exports = function (redisClient) {
var exports = {};
require('./commands').forEach(function (command) {
var commandLower = command.toLowerCase();
exports[command] = function () {
var args = Array.prototype.slice.call(arguments);
return function (done) {
args.push(done);
return redisClient[command].apply(redisClient, args);
}
/**
* Module dependencies.
*/
var thunkify = require('thunkify');
/**
* List of API functions that do not take a callback as an argument
* since they are not redis commands.
*
* @constant
* @type {Array}
*/
var API_FUNCTIONS = ['end', 'unref'];
/**
* Wrap `client`.
*
* @param {Redis} client
* @return {Object}
*/
module.exports = function (client) {
var wrap = {};
wrap.multi = function () {
var multi = client.multi();
multi.exec = thunkify(multi.exec);
return multi;
};
Object.keys(client).forEach(function (key) {
wrap[key] = client[key];
});
Object.defineProperty(wrap, 'connected', {
get: function () { return client.connected }
});
Object.defineProperty(wrap, 'retry_delay', {
get: function () { return client.retry_delay }
});
Object.defineProperty(wrap, 'retry_backoff', {
get: function () { return client.retry_backoff }
});
Object.keys(Object.getPrototypeOf(client)).forEach(function (key) {
var protoFunction = client[key].bind(client);
var isCommand = API_FUNCTIONS.indexOf(key) === -1;
var isMulti = key == 'multi';
if (isMulti) return;
if (isCommand) {
protoFunction = thunkify(protoFunction);
}
exports[commandLower] = exports[command];
wrap[key] = protoFunction;
});
return exports;
};
return wrap;
};

13

package.json
{
"name": "co-redis",
"description": "A node-redis wrapper to be used with visionmedia's co library",
"version": "0.0.3",
"version": "1.0.0",
"author": {

@@ -30,3 +30,3 @@ "name": "Martín Ciparelli",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha --harmony-generators"
},

@@ -38,6 +38,9 @@ "engines": {

"devDependencies": {
"co": "1.5.2",
"redis": "0.8.4",
"request": "2.20.0"
"co": "~3.0.2",
"redis": "~0.10.0",
"mocha": "~1.16.2"
},
"dependencies": {
"thunkify": "0.0.1"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc