bitburner-src/utils/uiHelpers/createOptionElement.ts

17 lines
348 B
TypeScript
Raw Normal View History

2019-01-10 09:20:04 +01:00
import { createElement } from "./createElement";
2021-09-05 01:09:30 +02:00
export function createOptionElement(
text: string,
value = "",
): HTMLOptionElement {
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
}