Skip to content

Commit 7a6e5bf

Browse files
committed
chore: better command definition
1 parent f84fc75 commit 7a6e5bf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ It provides the command definition so you can load it into any [ioredis](https:/
135135
```js
136136
const Redis = require('ioredis')
137137
const redis = new Redis(uri, {
138-
scripts: { ratelimiter: require('async-ratelimiter').defineCommand }
138+
scripts: { ...require('async-ratelimiter').defineCommand }
139139
})
140140
```
141141

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const assert = require('assert')
44
const microtime = require('./microtime')
55

6-
const defineCommand = {
6+
const ratelimiter = {
77
numberOfKeys: 1,
88
lua: `
99
local key = KEYS[1]
@@ -83,7 +83,7 @@ module.exports = class Limiter {
8383
this.duration = duration
8484
this.namespace = namespace
8585
if (!this.db.ratelimiter) {
86-
this.db.defineCommand('ratelimiter', defineCommand)
86+
this.db.defineCommand('ratelimiter', ratelimiter)
8787
}
8888
}
8989

@@ -107,4 +107,4 @@ module.exports = class Limiter {
107107
}
108108
}
109109

110-
module.exports.defineCommand = defineCommand
110+
module.exports.defineCommand = { ratelimiter }

0 commit comments

Comments
 (0)