bitburner-src/utils/uiHelpers/getSelectData.ts

26 lines
585 B
TypeScript
Raw Normal View History

export function getSelectValue(selector: HTMLSelectElement | null): string {
2021-09-05 01:09:30 +02:00
if (selector == null) {
return "";
}
if (selector.options.length <= 0) {
return "";
}
if (selector.selectedIndex < 0) {
return "";
}
return selector.options[selector.selectedIndex].value;
}
export function getSelectText(selector: HTMLSelectElement | null): string {
2021-09-05 01:09:30 +02:00
if (selector == null) {
return "";
}
if (selector.options.length <= 0) {
return "";
}
if (selector.selectedIndex < 0) {
return "";
}
return selector.options[selector.selectedIndex].text;
}