UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

31 lines (30 loc) 688 B
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