synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
31 lines (30 loc) • 688 B
JavaScript
import { getOnlyNonNullOneOfOption as n } from "./getOnlyNonNullOneOfOption.js";
import p from "lodash-es/isArray";
const i = {
type: "string",
isArray: !1
};
function e(t) {
const r = {
...i
};
if (t.format && (r.format = t.format), t.readOnly && (r.readOnly = t.readOnly), t.type) {
if (t.type === "array" && t.items) {
const f = Array.isArray(t.items) ? t.items[0] : t.items, y = e(f) ?? i;
return { ...r, ...y, isArray: !0 };
}
return { ...r, type: t.type };
}
if (t?.oneOf && p(t.oneOf)) {
const f = n(
t
);
if (f)
return e(f);
}
return r;
}
export {
e as getFlatTypeInfo
};
//# sourceMappingURL=getType.js.map