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

handy-redis

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handy-redis - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

dist/src/__tests__/flatten.test.d.ts

1

dist/src/index.d.ts
import { ClientOpts, RedisClient } from "redis";
import { IHandyRedis } from "./generated/interface";
export * from "redis";
export * from "./generated/interface";

@@ -5,0 +4,0 @@ export interface ICreateHandyClient {

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
const redis_1 = require("redis");
const client_1 = require("./generated/client");
__export(require("redis"));
exports.createHandyClient = (...args) => {

@@ -10,0 +6,0 @@ if (args.length === 1 && typeof args[0].zscan === "function") {

{
"name": "handy-redis",
"version": "1.1.0",
"version": "1.1.1",
"description": "A wrapper around node_redis with Promise and TypeScript support.",

@@ -12,7 +12,9 @@ "main": "dist/src/index.js",

"clean": "shx rm -rf {dist,src/generated}",
"precompile": "ts-node scripts/generate-client",
"compile": "tsc --project .",
"prebuild": "ts-node scripts/generate-client",
"build": "tsc --project .",
"lint": "tslint **/*.ts",
"pretest": "npm run compile",
"test": "ava dist/test **/__tests__/*.js",
"pretest": "npm run build",
"test": "npm run test:unit",
"test:unit": "ava dist/test **/__tests__/*.js",
"posttest": "npm run lint",

@@ -19,0 +21,0 @@ "semantic-release": "semantic-release pre && npm publish && semantic-release post",

# handy-redis
A wrapper around node_redis with Promise and TypeScript support.
A wrapper around [node_redis](https://npmjs.com/package/redis) with Promise and TypeScript support.
[![Build Status](https://travis-ci.org/mmkal/hodor.svg?branch=master)](https://travis-ci.org/mmkal/handy-redis)
[![Build Status](https://travis-ci.org/mmkal/handy-redis.svg?branch=master)](https://travis-ci.org/mmkal/handy-redis)
## Why
[node_redis](https://npmjs.com/package/redis) doesn't support Promises out-of-the-box - you have to use bluebird's `promisifyAll`, which has the side effect of removing all TypeScript/intellisense support from the package.
This package exclusively uses Promises, and the TypeScript types are generated from the official redis documentation and examples, so it's much easier to know what parameters a command expects.
## Using
```cli
npm install --save handy-redis
```
ES6/TypeScript:
```JavaScript
import { createHandyClient } from 'handy-redis';
(async function() {
const client = createHandyClient();
// or, call createHandyClient(opts) using opts for https://npmjs.com/package/redis
// or, call createHandyClient(oldClient) where oldClient is an existing node_redis client.
await client.set('foo', 'bar');
const foo = await client.get('foo');
console.log(foo);
})();
```
Vanilla JS:
```JavaScript
const handyRedis = require('handy-redis');
const client = handyRedis.createHandyClient();
client
.set('foo', 'bar')
.then(() => client.get('foo'))
.then(foo => console.log(foo));
```
The package is published with TypeScript types, with the redis documentation and response type attached to each command:
![](./docs/intellisense.png)
## Development
Most of the package is generated by running sample commands from the redis documentation repo.
```cli
git clone https://github.com/mmkal/handy-redis --recursive
npm install
npm test
```
`npm test` triggers `npm run build` before running the tests - and the `build` script generates the client before using TypeScript to compile it.
If you cloned without `--recursive` you'll need to run `git submodule update --init` to get the redis-doc repo locally.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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