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

            Line data    Source code
       1              : export type CoreMediaMenuActionKind = 'input' | 'preview'
       2              : 
       3         2356 : const coreMediaMenuActionKinds = new WeakMap<object, CoreMediaMenuActionKind>()
       4              : 
       5          812 : export function markCoreMediaMenuCallback<T extends object>(
       6              :   callback: T,
       7              :   kind: CoreMediaMenuActionKind
       8              : ): T {
       9          812 :   coreMediaMenuActionKinds.set(callback, kind)
      10          812 :   return callback
      11              : }
      12              : 
      13         2309 : export function filterUnavailableCoreMediaMenuActions<T>(
      14              :   options: readonly T[],
      15              :   unavailableKinds: ReadonlySet<CoreMediaMenuActionKind>
      16              : ): T[] {
      17         2309 :   return options.filter((option) => {
      18        40529 :     if (!option || typeof option !== 'object' || !('callback' in option))
      19         6936 :       return true
      20              : 
      21        33593 :     const { callback } = option
      22        40529 :     if (typeof callback !== 'function') return true
      23              : 
      24        33593 :     const kind = coreMediaMenuActionKinds.get(callback)
      25        40529 :     return !kind || !unavailableKinds.has(kind)
      26              :   })
      27              : }
        

Generated by: LCOV version 2.0-1