Commit 4ccaaa6 1 parent abe142a commit 4ccaaa6 Copy full SHA for 4ccaaa6
File tree 2 files changed +20
-10
lines changed
2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 1
1
import { ChainableCommander } from 'ioredis' ;
2
- import { invert } from 'lodash' ;
3
2
import { debuglog } from 'util' ;
4
3
import {
5
4
BackoffOptions ,
@@ -24,6 +23,7 @@ import {
24
23
} from '../types' ;
25
24
import {
26
25
errorObject ,
26
+ invertObject ,
27
27
isEmpty ,
28
28
getParentKey ,
29
29
lengthInUtf8Bytes ,
@@ -44,7 +44,7 @@ const optsDecodeMap = {
44
44
rdof : 'removeDependencyOnFailure' ,
45
45
} ;
46
46
47
- const optsEncodeMap = invert ( optsDecodeMap ) ;
47
+ const optsEncodeMap = invertObject ( optsDecodeMap ) ;
48
48
49
49
export const PRIORITY_LIMIT = 2 ** 21 ;
50
50
Original file line number Diff line number Diff line change @@ -67,6 +67,24 @@ export function delay(
67
67
} ) ;
68
68
}
69
69
70
+ export function increaseMaxListeners (
71
+ emitter : EventEmitter ,
72
+ count : number ,
73
+ ) : void {
74
+ const maxListeners = emitter . getMaxListeners ( ) ;
75
+ emitter . setMaxListeners ( maxListeners + count ) ;
76
+ }
77
+
78
+ export const invertObject = ( obj : Record < string , string > ) => {
79
+ return Object . entries ( obj ) . reduce < Record < string , string > > (
80
+ ( encodeMap , [ key , value ] ) => {
81
+ encodeMap [ value ] = key ;
82
+ return encodeMap ;
83
+ } ,
84
+ { } ,
85
+ ) ;
86
+ } ;
87
+
70
88
export function isRedisInstance ( obj : any ) : obj is Redis | Cluster {
71
89
if ( ! obj ) {
72
90
return false ;
@@ -79,14 +97,6 @@ export function isRedisCluster(obj: unknown): obj is Cluster {
79
97
return isRedisInstance ( obj ) && ( < Cluster > obj ) . isCluster ;
80
98
}
81
99
82
- export function increaseMaxListeners (
83
- emitter : EventEmitter ,
84
- count : number ,
85
- ) : void {
86
- const maxListeners = emitter . getMaxListeners ( ) ;
87
- emitter . setMaxListeners ( maxListeners + count ) ;
88
- }
89
-
90
100
export function decreaseMaxListeners (
91
101
emitter : EventEmitter ,
92
102
count : number ,
You can’t perform that action at this time.
0 commit comments