File tree Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1111 "lint:fix" : " eslint --fix src test @types" ,
1212 "prettier" : " prettier --write ." ,
1313 "prepare" : " husky install" ,
14- "build" : " tsc"
14+ "build" : " tsc" ,
15+ "build:fix" : " node node_modules/.bin/yab dist"
1516 },
1617 "repository" : {
1718 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class FixedWindow implements RateLimiter {
3131 this . windowSize = windowSize ;
3232 this . client = client ;
3333 this . keyExpiry = expiry ;
34- if ( windowSize <= 0 || capacity <= 0 || expiry <= 0 )
34+ if ( ! windowSize || ! capacity || windowSize <= 0 || capacity <= 0 || expiry <= 0 )
3535 throw Error ( 'FixedWindow windowSize, capacity and keyExpiry must be positive' ) ;
3636 }
3737
@@ -68,7 +68,7 @@ class FixedWindow implements RateLimiter {
6868 // attempt to get the value for the uuid from the redis cache
6969 const windowJSON = await this . client . get ( uuid ) ;
7070
71- if ( windowJSON === null ) {
71+ if ( ! windowJSON ) {
7272 const newUserWindow : Window = {
7373 currentTokens : tokens > this . capacity ? 0 : tokens ,
7474 fixedWindowStart : timestamp ,
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class SlidingWindowCounter implements RateLimiter {
3636 this . capacity = capacity ;
3737 this . client = client ;
3838 this . keyExpiry = expiry ;
39- if ( windowSize <= 0 || capacity <= 0 || expiry <= 0 )
39+ if ( ! windowSize || ! capacity || windowSize <= 0 || capacity <= 0 || expiry <= 0 )
4040 throw SyntaxError (
4141 'SlidingWindowCounter window size, capacity and keyExpiry must be positive'
4242 ) ;
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class SlidingWindowLog implements RateLimiter {
3535 this . capacity = capacity ;
3636 this . client = client ;
3737 this . keyExpiry = expiry ;
38- if ( windowSize <= 0 || capacity <= 0 || expiry <= 0 )
38+ if ( ! windowSize || ! capacity || windowSize <= 0 || capacity <= 0 || expiry <= 0 )
3939 throw SyntaxError (
4040 'SlidingWindowLog window size, capacity and keyExpiry must be positive'
4141 ) ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class TokenBucket implements RateLimiter {
3030 this . refillRate = refillRate ;
3131 this . client = client ;
3232 this . keyExpiry = expiry ;
33- if ( refillRate <= 0 || capacity <= 0 || expiry <= 0 )
33+ if ( ! refillRate || ! capacity || refillRate <= 0 || capacity <= 0 || expiry <= 0 )
3434 throw Error ( 'TokenBucket refillRate, capacity and keyExpiry must be positive' ) ;
3535 }
3636
You can’t perform that action at this time.
0 commit comments