Skip to content

Commit 6acba44

Browse files
shiv-tyagitridge
authored andcommitted
static: js: rename getters to convey that they are for option objects
1 parent 7a64539 commit 6acba44

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

static/js/add_build.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Features = (() => {
1818
category['options'].forEach((option) => {
1919
if (option.dependency != null) {
2020
option.dependency.split(',').forEach((dependency) => {
21-
let dep = getByLabel(dependency);
21+
let dep = getOptionByLabel(dependency);
2222
if (dep.requiredFor == undefined) {
2323
dep.requiredFor = [];
2424
}
@@ -35,11 +35,11 @@ const Features = (() => {
3535
updateRequiredFor();
3636
}
3737

38-
function getByDefine(define) {
38+
function getOptionByDefine(define) {
3939
return defines_dictionary[define];
4040
}
4141

42-
function getByLabel(label) {
42+
function getOptionByLabel(label) {
4343
return labels_dictionary[label];
4444
}
4545

@@ -50,8 +50,8 @@ const Features = (() => {
5050
for (let i=0; i<defines_array.length; i++) {
5151
let select_opt = (defines_array[i][0] != '!');
5252
let sanitised_define = (select_opt ? defines_array[i] : defines_array[i].substring(1)); // this removes the leading '!' from define if it contatins
53-
if (getByDefine(sanitised_define)) {
54-
getByDefine(sanitised_define).default = select_opt ? 1 : 0;
53+
if (getOptionByDefine(sanitised_define)) {
54+
getOptionByDefine(sanitised_define).default = select_opt ? 1 : 0;
5555
}
5656
}
5757
}
@@ -63,7 +63,7 @@ const Features = (() => {
6363

6464
visited[feature_label] = true;
6565
document.getElementById(feature_label).checked = true;
66-
let feature = getByLabel(feature_label);
66+
let feature = getOptionByLabel(feature_label);
6767

6868
if (feature.dependency == null) {
6969
return;
@@ -109,7 +109,7 @@ const Features = (() => {
109109
visited[feature_label] = true;
110110
dependent_features.push(feature_label);
111111

112-
let feature = getByLabel(feature_label);
112+
let feature = getOptionByLabel(feature_label);
113113
if (feature.requiredFor == null) {
114114
return;
115115
}
@@ -123,8 +123,8 @@ const Features = (() => {
123123
let dependent_features = [];
124124
let visited = {};
125125

126-
if (getByLabel(feature_label).requiredFor) {
127-
getByLabel(feature_label).requiredFor.forEach((dependent_feature) => {
126+
if (getOptionByLabel(feature_label).requiredFor) {
127+
getOptionByLabel(feature_label).requiredFor.forEach((dependent_feature) => {
128128
getEnabledDependentFeaturesHelper(dependent_feature, visited, dependent_features);
129129
});
130130
}
@@ -133,11 +133,11 @@ const Features = (() => {
133133
}
134134

135135
function disableDependents(feature_label) {
136-
if (getByLabel(feature_label).requiredFor == undefined) {
136+
if (getOptionByLabel(feature_label).requiredFor == undefined) {
137137
return;
138138
}
139139

140-
getByLabel(feature_label).requiredFor.forEach((dependent_feature) => {
140+
getOptionByLabel(feature_label).requiredFor.forEach((dependent_feature) => {
141141
document.getElementById(dependent_feature).checked = false;
142142
});
143143
}

0 commit comments

Comments
 (0)