useGetCategoryByComponentKey.ts 366 Bytes
import { PackagesCategoryEnum } from '../index.type';
import { packageList } from '../package';

export const useGetCategoryByComponentKey = (componentKey: string) => {
  for (const key of Object.keys(packageList) as PackagesCategoryEnum[]) {
    for (const item of packageList[key]) {
      if (item.key === componentKey) {
        return key;
      }
    }
  }
};