All files / metadata/src/utilities/metadataProvider calibrationModule.ts

38.46% Statements 5/13
75% Branches 3/4
100% Functions 2/2
38.46% Lines 5/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32              5074x 46x   5028x 5028x                                   384x    
import { MetadataModules } from '../../enums';
import { addTypedProvider, toLowerCamelTag } from '../../metaData';
 
/**
 * Converts the calibration object if any to lower case
 */
export function calibrationModuleProvider(next, query, data, options) {
  if (!data) {
    return next(query, data, options);
  }
  Eif (!data.SequenceOfUltrasoundRegions?.length) {
    return;
  }
  const { SequenceOfUltrasoundRegions } = data;
  const sequenceOfUltrasoundRegions = [];
 
  for (const sequenceItem of SequenceOfUltrasoundRegions) {
    const newItem = {};
    sequenceOfUltrasoundRegions.push(newItem);
    for (const [key, value] of Object.entries(sequenceItem)) {
      newItem[toLowerCamelTag(key)] = value;
    }
  }
  return {
    sequenceOfUltrasoundRegions,
  };
}
 
export function registerCalibrationModule() {
  addTypedProvider(MetadataModules.CALIBRATION, calibrationModuleProvider);
}