( name: keyof ObjectDirective, dir: ObjectDirective & LegacyDirective, instance: ComponentInternalInstance | null, )
| 24 | } |
| 25 | |
| 26 | export function mapCompatDirectiveHook( |
| 27 | name: keyof ObjectDirective, |
| 28 | dir: ObjectDirective & LegacyDirective, |
| 29 | instance: ComponentInternalInstance | null, |
| 30 | ): DirectiveHook | DirectiveHook[] | undefined { |
| 31 | const mappedName = legacyDirectiveHookMap[name] |
| 32 | if (mappedName) { |
| 33 | if (isArray(mappedName)) { |
| 34 | const hook: DirectiveHook[] = [] |
| 35 | mappedName.forEach(mapped => { |
| 36 | const mappedHook = dir[mapped] |
| 37 | if (mappedHook) { |
| 38 | softAssertCompatEnabled( |
| 39 | DeprecationTypes.CUSTOM_DIR, |
| 40 | instance, |
| 41 | mapped, |
| 42 | name, |
| 43 | ) |
| 44 | hook.push(mappedHook) |
| 45 | } |
| 46 | }) |
| 47 | return hook.length ? hook : undefined |
| 48 | } else { |
| 49 | if (dir[mappedName]) { |
| 50 | softAssertCompatEnabled( |
| 51 | DeprecationTypes.CUSTOM_DIR, |
| 52 | instance, |
| 53 | mappedName, |
| 54 | name, |
| 55 | ) |
| 56 | } |
| 57 | return dir[mappedName] |
| 58 | } |
| 59 | } |
| 60 | } |
no test coverage detected