Skip to content

Commit ad47f74

Browse files
♻️ refactor(_from_small_list): Do not use default case.
1 parent e1c909c commit ad47f74

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/0-core/_fast/_from_small_list.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ import {Empty, Single, Deep} from '../../3-tree/index.js';
33
import {One, Two} from '../../1-digit/index.js';
44
import {cache} from '../measure/index.js';
55

6+
export const THRESHOLD = 3;
7+
68
export function _from_small_list(M, list) {
7-
assert(Number.isInteger(list.length) && list.length >= 0 && list.length <= 3);
9+
assert(
10+
Number.isInteger(list.length) &&
11+
list.length >= 0 &&
12+
list.length <= THRESHOLD,
13+
);
14+
// eslint-disable-next-line default-case
815
switch (list.length) {
916
case 0:
1017
return new Empty(M);
@@ -17,7 +24,7 @@ export function _from_small_list(M, list) {
1724
new Empty(cache(M)),
1825
new One(list[1]),
1926
);
20-
default:
27+
case 3:
2128
return new Deep(
2229
M,
2330
new Two(list[0], list[1]),

0 commit comments

Comments
 (0)