(
schema: any,
)
| 23 | getProperties, |
| 24 | ) => { |
| 25 | const toCellOrValueSchema = ( |
| 26 | schema: any, |
| 27 | ): CellSchema | ValueSchema | undefined => { |
| 28 | const [unwrapped, defaultValue, allowNull] = unwrapSchema(schema); |
| 29 | const type = unwrapped?.type; |
| 30 | |
| 31 | if ( |
| 32 | type !== STRING && |
| 33 | type !== NUMBER && |
| 34 | type !== BOOLEAN && |
| 35 | type !== OBJECT && |
| 36 | type !== ARRAY |
| 37 | ) { |
| 38 | return undefined; |
| 39 | } |
| 40 | |
| 41 | const cellOrValueSchema: CellSchema = {[TYPE]: type} as CellSchema; |
| 42 | ifNotUndefined(defaultValue, (defaultValue) => { |
| 43 | (cellOrValueSchema as any)[DEFAULT] = defaultValue; |
| 44 | }); |
| 45 | if (allowNull) { |
| 46 | (cellOrValueSchema as any)[ALLOW_NULL] = true; |
| 47 | } |
| 48 | return cellOrValueSchema; |
| 49 | }; |
| 50 | |
| 51 | const toTablesSchema = (schemas: {[tableId: string]: any}): TablesSchema => { |
| 52 | const tablesSchema: TablesSchema = objNew(); |
no test coverage detected
searching dependent graphs…