LCOV - code coverage report
Current view: top level - src/utils - widgetPropFilter.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 11 11
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : // Props to exclude based on the widget interface specifications
       2          883 : export const STANDARD_EXCLUDED_PROPS = [
       3              :   'style',
       4              :   'class',
       5              :   'dt',
       6              :   'pt',
       7              :   'ptOptions',
       8              :   'unstyled'
       9              : ] as const
      10              : 
      11          883 : export const INPUT_EXCLUDED_PROPS = [
      12              :   ...STANDARD_EXCLUDED_PROPS,
      13              :   'inputClass',
      14              :   'inputStyle',
      15              :   'read_only'
      16              : ] as const
      17              : 
      18          883 : export const PANEL_EXCLUDED_PROPS = [
      19              :   ...STANDARD_EXCLUDED_PROPS,
      20              :   'panelClass',
      21              :   'panelStyle',
      22              :   'overlayClass'
      23              : ] as const
      24              : 
      25              : // export const IMAGE_EXCLUDED_PROPS = [
      26              : //   ...STANDARD_EXCLUDED_PROPS,
      27              : //   'imageClass',
      28              : //   'imageStyle'
      29              : // ] as const
      30              : 
      31          883 : export const BADGE_EXCLUDED_PROPS = [
      32              :   ...STANDARD_EXCLUDED_PROPS,
      33              :   'badgeClass'
      34              : ] as const
      35              : 
      36              : /**
      37              :  * Filters widget props by excluding specified properties
      38              :  * @param props - The props object to filter
      39              :  * @param excludeList - List of property names to exclude
      40              :  * @returns Filtered props object
      41              :  */
      42        17732 : export function filterWidgetProps<T extends object>(
      43              :   props: T | undefined,
      44              :   excludeList: readonly string[]
      45              : ): Partial<T> {
      46        17732 :   if (!props) return {}
      47              : 
      48        17732 :   const filtered: Record<string, unknown> = {}
      49        17732 :   for (const [key, value] of Object.entries(props)) {
      50        95277 :     if (!excludeList.includes(key)) {
      51        95177 :       filtered[key] = value
      52              :     }
      53              :   }
      54        17732 :   return filtered as Partial<T>
      55              : }
        

Generated by: LCOV version 2.0-1