@legion-ui-kit/react-core
Version:
<div align="center"> <img height="108" width="116" src="https://legion.digitaltelkom.id/favicon.svg?v=4643a71fb65fa61a5f2b266b769ea7b1" /> <h1 align="center">Legion UI Kit - React Core</h1> </div>
1 lines • 1.3 kB
Source Map (JSON)
{"version":3,"file":"internal.cjs","sources":["../../../src/helpers/internal.ts"],"sourcesContent":["// Helpers\r\nimport { isValidElement } from 'react';\r\n\r\n/**\r\n * Check if component is a specific component based on it's name / displayName\r\n * @param component The component that want to be checked\r\n * @param displayName The name / displayName of the expected component\r\n */\r\nexport const checkComponent = (component: any, displayName: string) => {\r\n\tif (!isValidElement(component)) return false\r\n\t/* @ts-expect-error The component is literally can be anything */\r\n\telse if (component?.name === displayName) return true\r\n\t/* @ts-expect-error The component is literally can be anything */\r\n\telse if (component?.displayName === displayName) return true\r\n\t/* @ts-expect-error The component is literally can be anything */\r\n\telse if (component?.type?.name === displayName) return true\r\n\t/* @ts-expect-error The component is literally can be anything */\r\n\telse if (component?.type?.displayName === displayName) return true\r\n\telse return false\r\n}\r\n"],"names":["component","displayName","isValidElement","name","type"],"mappings":"2DAQ8B,CAACA,EAAgBC,MACzCC,EAAAA,eAAeF,KAEXA,GAAWG,OAASF,IAEpBD,GAAWC,cAAgBA,IAE3BD,GAAWI,MAAMD,OAASF,GAE1BD,GAAWI,MAAMH,cAAgBA"}