Skip to content

Commit 28e6e42

Browse files
committed
Remove unnecessary comments and code in initialize function
1 parent 3086a44 commit 28e6e42

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/index.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,9 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
113113
return result;
114114
},
115115

116-
// Do we need this?
117116
exists(key) {
118117
return this.get(key) !== null;
119118
},
120-
121-
// Helper to get all keys that have flags (real or override)
122-
// Do we need this?
123-
getAllKeys() {
124-
return new Set([...Object.keys(flags || {}), ...Object.keys(flagOverrides || {})]);
125-
},
126119
};
127120

128121
let useLocalStorage;
@@ -930,14 +923,13 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
930923

931924
const newFlag = utils.extend({}, data);
932925
delete newFlag['key'];
933-
flagOverrides[data.key] = newFlag; // Store in overrides, not flags
926+
flagOverrides[data.key] = newFlag;
934927
const newDetail = getFlagDetail(newFlag);
935928

936929
mods[data.key] = { previous: currentValue, current: newDetail };
937930

938-
// Do we need this?
939931
notifyInspectionFlagChanged(data, newFlag);
940-
handleFlagChanges(mods); // don't wait for this Promise to be resolved
932+
handleFlagChanges(mods);
941933
}
942934

943935
function removeOverride(key) {
@@ -946,12 +938,11 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
946938
const oldOverride = flagOverrides[key];
947939
const realFlag = flags[key];
948940

949-
// Always create change event since we're removing an override
950941
mods[key] = { previous: oldOverride.value, current: realFlag ? getFlagDetail(realFlag) : undefined };
951942

952-
delete flagOverrides[key]; // Remove the override
943+
delete flagOverrides[key];
953944
notifyInspectionFlagChanged({ key }, realFlag);
954-
handleFlagChanges(mods); // don't wait for this Promise to be resolved
945+
handleFlagChanges(mods);
955946
}
956947
}
957948

@@ -964,10 +955,10 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
964955
mods[key] = { previous: oldOverride.value, current: realFlag ? getFlagDetail(realFlag) : undefined };
965956
});
966957

967-
flagOverrides = {}; // Clear all overrides
958+
flagOverrides = {};
968959

969960
if (Object.keys(mods).length > 0) {
970-
handleFlagChanges(mods); // don't wait for this Promise to be resolved
961+
handleFlagChanges(mods);
971962
}
972963
}
973964

0 commit comments

Comments
 (0)