openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
15 lines (14 loc) • 522 B
JavaScript
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CCIiB4H7.mjs";
import { t as formatHumanList } from "./human-list-CcomOfAw.mjs";
//#region src/shared/enum-option.ts
function createEnumOptionParser(e = Error) {
return (t, n, r) => {
const i = normalizeOptionalLowercaseString(t);
if (!i) return;
const a = n.find((e) => e.toLowerCase() === i);
if (a === void 0) throw new e(`${r} must be one of ${formatHumanList(n)}`);
return a;
};
}
//#endregion
export { createEnumOptionParser as t };