Skip to content

Commit 6e178d7

Browse files
#RI-4880 - resolve comments
1 parent 9e420e1 commit 6e178d7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

redisinsight/ui/src/utils/redistack.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@ const REDISTACK_OPTIONAL_MODULES: Array<string | Array<string>> = [
1616
[RedisDefaultModules.RedisGears, RedisDefaultModules.RedisGears2]
1717
]
1818

19+
const MIN_MODULES_LENGTH = REDISTACK_REQUIRE_MODULES.length
20+
const MAX_MODULES_LENGTH = REDISTACK_REQUIRE_MODULES.length + REDISTACK_OPTIONAL_MODULES.length
21+
1922
const checkRediStackModules = (modules: any[]) => {
2023
if (!modules?.length) return false
2124
const moduleNames = map(modules, 'name').sort()
2225

23-
if (modules.length === REDISTACK_REQUIRE_MODULES.length) {
26+
if (modules.length === MIN_MODULES_LENGTH) {
2427
return moduleNames
2528
.every((m, index) => (isArray(REDISTACK_REQUIRE_MODULES[index])
2629
? (REDISTACK_REQUIRE_MODULES[index] as Array<string>).some((rm) => rm === m)
2730
: REDISTACK_REQUIRE_MODULES[index] === m))
2831
}
2932

30-
if (modules.length > REDISTACK_REQUIRE_MODULES.length
31-
&& modules.length <= (REDISTACK_REQUIRE_MODULES.length + REDISTACK_OPTIONAL_MODULES.length)) {
33+
if (modules.length > MIN_MODULES_LENGTH
34+
&& modules.length <= (MAX_MODULES_LENGTH)) {
3235
let isCustomModule = false
3336
const rediStackModules = concat(REDISTACK_REQUIRE_MODULES, REDISTACK_OPTIONAL_MODULES).sort()
3437

@@ -39,9 +42,11 @@ const checkRediStackModules = (modules: any[]) => {
3942

4043
if (moduleName) {
4144
remove(acc, (name) => moduleName === name)
45+
4246
return acc
4347
}
4448
isCustomModule = true
49+
4550
return acc
4651
}, moduleNames)
4752

0 commit comments

Comments
 (0)