https://github.com/noderedis/redis-commands
A module that exports all available Redis commands and their supported Redis versions.
https://github.com/noderedis/redis-commands
Last synced: about 1 year ago
JSON representation
A module that exports all available Redis commands and their supported Redis versions.
- Host: GitHub
- URL: https://github.com/noderedis/redis-commands
- Owner: NodeRedis
- License: mit
- Created: 2015-03-25T10:37:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-12-21T07:59:31.000Z (over 1 year ago)
- Last Synced: 2025-05-15T02:09:50.026Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 435 KB
- Stars: 84
- Watchers: 7
- Forks: 31
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# Redis Commands
[](https://travis-ci.org/NodeRedis/redis-commands)
[](https://codeclimate.com/github/NodeRedis/redis-commands)
[](https://codeclimate.com/github/NodeRedis/redis-commands/coverage)
This module exports all the commands that Redis supports.
## Install
```shell
$ npm install redis-commands
```
## Usage
```javascript
var commands = require('redis-commands');
```
`.list` is an array contains all the lowercased commands:
```javascript
commands.list.forEach(function (command) {
console.log(command);
});
```
`.exists()` is used to check if the command exists:
```javascript
commands.exists('set') // true
commands.exists('other-command') // false
```
`.hasFlag()` is used to check if the command has the flag:
```javascript
commands.hasFlag('set', 'readonly') // false
```
`.getKeyIndexes()` is used to get the indexes of keys in the command arguments:
```javascript
commands.getKeyIndexes('set', ['key', 'value']) // [0]
commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]
```
## Acknowledgment
Thank [@Yuan Chuan](https://github.com/yuanchuan) for the package name. The original redis-commands is renamed to [@yuanchuan/redis-commands](https://www.npmjs.com/package/@yuanchuan/redis-commands).