All files / dicomImageLoader/src/imageLoader/wadors/metaData getSequenceItems.ts

50% Statements 4/8
50% Branches 3/6
100% Functions 1/1
50% Lines 4/8

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          40x 8x     32x                   32x        
import type { WADORSMetaDataElement } from '../../../types';
 
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getSequenceItems(element: any): WADORSMetaDataElement[] {
  // Value is not present if the attribute has a zero length value
  if (!element?.Value?.length) {
    return [];
  }
 
  Iif (!Array.isArray(element.Value)) {
    // If the Value is an object, encapsulate it in an array and log a warning message
    if (typeof element.Value === 'object') {
      console.warn(
        'Warning: Value should be an array, but an object was found. Encapsulating the object in an array.'
      );
      return [element.Value];
    }
    return [];
  }
  return element.Value;
}
 
export default getSequenceItems;