(objectOperand: any, key: string, propertySchema: any)
| 52 | * @param propertySchema |
| 53 | */ |
| 54 | export const getObjectOperandProperty = (objectOperand: any, key: string, propertySchema: any) => { |
| 55 | if (isObjectOperand(objectOperand)) { |
| 56 | const keyIndex = (objectOperand.value.operands as any[]).findIndex((operand, index) => { |
| 57 | return index % 2 === 0 && typeof operand === 'string' ? key === operand : isEqual(operand, key); |
| 58 | }); |
| 59 | if (keyIndex > -1) { |
| 60 | return objectOperand.value.operands[keyIndex + 1]; |
| 61 | } |
| 62 | return JSON.parse(JSON.stringify(EmptyNullOperand)); |
| 63 | } |
| 64 | // when formData is empty, return default null value |
| 65 | if (objectOperand == null || Object.keys(objectOperand).length === 0) { |
| 66 | return JSON.parse(JSON.stringify(EmptyNullOperand)); |
| 67 | } |
| 68 | switch (propertySchema.type) { |
| 69 | case 'object': |
| 70 | return JSON.parse(JSON.stringify(EmptyObjectOperand)); |
| 71 | case 'array': |
| 72 | return JSON.parse(JSON.stringify(EmptyArrayOperand)); |
| 73 | default: |
| 74 | return JSON.parse(JSON.stringify(EmptyNullOperand)); |
| 75 | } |
| 76 | }; |
| 77 | |
| 78 | const getExpressionOperatorReturnType = (operator: string) => { |
| 79 | const OperatorReturnTypeMap = { |
no test coverage detected