toCapturePropertySwitch function

dynamic toCapturePropertySwitch(
  1. dynamic prop,
  2. dynamic finalVal
)

Helper for determining which property should be assigned to the value (used in response) property.

Implementation

toCapturePropertySwitch(prop, finalVal) {
  switch (finalVal.type) {
    case CapturePropertyTypes.dataSource:
      finalVal.value = prop.dataSource;
      break;
    case CapturePropertyTypes.array:
      finalVal.value = prop.arrayValue;
      break;
    case CapturePropertyTypes.string:
      finalVal.value = prop.stringValue;
      break;
    case CapturePropertyTypes.byte:
      finalVal.value = prop.byteValue;
      break;
    default:
      finalVal.value = {};
  }
  return finalVal;
}