synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
30 lines (29 loc) • 778 B
JavaScript
import { getOnlyNonNullOneOfOption as o } from "./getOnlyNonNullOneOfOption.js";
import { optionsList as n } from "@rjsf/utils";
import i from "lodash-es/isArray";
import u from "lodash-es/isObject";
function f(e) {
return { value: e.value };
}
function l(e) {
return i(e) && e.every((t) => u(t) && "const" in t);
}
function m(e) {
let t = [];
if (e.type === "boolean")
return [{ value: !0 }, { value: !1 }];
try {
if (e?.oneOf && i(e.oneOf) && !l(e.oneOf)) {
const r = o(e);
r && Object.hasOwn(r, "enum") && (t = n(r) || []);
} else
t = n(e) || [];
} catch (r) {
console.error("Error getting enumerated values from schema", r, e);
}
return t.map(f);
}
export {
m as default
};
//# sourceMappingURL=getEnumeratedValues.js.map