bitburner-src/utils/uiHelpers/createOptionElement.ts

14 lines
341 B
TypeScript
Raw Normal View History

2019-01-10 09:20:04 +01:00
import { createElement } from "./createElement";
2021-09-09 05:47:34 +02:00
export function createOptionElement(text: string, value = ""): HTMLOptionElement {
2021-09-05 01:09:30 +02:00
let sanitizedValue: string = value;
if (sanitizedValue === "") {
sanitizedValue = text;
}
2019-01-10 09:20:04 +01:00
2021-09-05 01:09:30 +02:00
return createElement("option", {
text: text,
value: sanitizedValue,
}) as HTMLOptionElement;
2019-01-10 09:20:04 +01:00
}