Skip to content

Commit 6b8057d

Browse files
committed
Update document
1 parent fca9a03 commit 6b8057d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,27 @@ $ npm install redis-commands
1616
var commands = require('redis-commands');
1717
```
1818

19+
`.list` is an array contains all the lowercased commands:
20+
21+
```javascript
1922
commands.list.forEach(function (command) {
2023
console.log(command);
2124
});
2225
```
2326

27+
`.hasFlag` is used to check if the command has the flag:
28+
29+
```javascript
30+
commands.hasFlag('set', 'readonly') // false
31+
```
32+
33+
`.getKeyIndexes` is used to get the indexes of keys in the command arguments:
34+
35+
```javascript
36+
commands.getKeyIndexes('set', ['key', 'value']) // [0]
37+
commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]
38+
```
39+
2440
## Acknowledgment
2541

2642
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).

0 commit comments

Comments
 (0)