@@ -6,12 +6,9 @@ const Features = (() => {
6
6
function resetDictionaries ( ) {
7
7
defines_dictionary = { } ; // clear old dictionary
8
8
labels_dictionary = { } ; // clear old dictionary
9
- features . forEach ( ( category , cat_idx ) => {
10
- category [ 'options' ] . forEach ( ( option , opt_idx ) => {
11
- defines_dictionary [ option . define ] = labels_dictionary [ option . label ] = {
12
- 'category_index' : cat_idx ,
13
- 'option_index' : opt_idx ,
14
- } ;
9
+ features . forEach ( ( category ) => {
10
+ category [ 'options' ] . forEach ( ( option ) => {
11
+ defines_dictionary [ option . define ] = labels_dictionary [ option . label ] = option ;
15
12
} ) ;
16
13
} ) ;
17
14
}
@@ -39,19 +36,11 @@ const Features = (() => {
39
36
}
40
37
41
38
function getByDefine ( define ) {
42
- let dict_value = defines_dictionary [ define ] ;
43
- if ( dict_value == undefined ) {
44
- return null ;
45
- }
46
- return features [ dict_value [ 'category_index' ] ] [ 'options' ] [ dict_value [ 'option_index' ] ] ;
39
+ return defines_dictionary [ define ] ;
47
40
}
48
41
49
42
function getByLabel ( label ) {
50
- let dict_value = labels_dictionary [ label ] ;
51
- if ( dict_value == undefined ) {
52
- return null ;
53
- }
54
- return features [ dict_value [ 'category_index' ] ] [ 'options' ] [ dict_value [ 'option_index' ] ] ;
43
+ return labels_dictionary [ label ] ;
55
44
}
56
45
57
46
function updateDefaults ( defines_array ) {
@@ -62,8 +51,6 @@ const Features = (() => {
62
51
let select_opt = ( defines_array [ i ] [ 0 ] != '!' ) ;
63
52
let sanitised_define = ( select_opt ? defines_array [ i ] : defines_array [ i ] . substring ( 1 ) ) ; // this removes the leading '!' from define if it contatins
64
53
if ( getByDefine ( sanitised_define ) ) {
65
- let cat_idx = defines_dictionary [ sanitised_define ] [ 'category_index' ] ;
66
- let opt_idx = defines_dictionary [ sanitised_define ] [ 'option_index' ] ;
67
54
getByDefine ( sanitised_define ) . default = select_opt ? 1 : 0 ;
68
55
}
69
56
}
0 commit comments