blob: 78f36925dbe021d8606745b18bbdf6a255e76fa5 [file] [log] [blame]
import {
OptionCodename,
OptionsValues,
optionCodenames,
} from './optionsPrototype';
/**
* Representation of a specific configuration of the option values.
*/
export class OptionsConfiguration {
constructor(public optionsValues: OptionsValues) {}
getOptionValue<O extends OptionCodename>(option: O): OptionsValues[O] {
return this.optionsValues[option];
}
isEnabled(option: OptionCodename): boolean {
const value = this.getOptionValue(option);
return value === true;
}
isEqualTo(otherConfiguration: OptionsConfiguration) {
for (const option of optionCodenames) {
const thisValue = this.getOptionValue(option);
const otherValue = otherConfiguration.getOptionValue(option);
if (thisValue !== otherValue) {
return false;
}
}
return true;
}
}