Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

286 B
Raw Blame
export function createEnumMap<T extends Record<string, string | number>>(
  EnumObject: T
) {
  return Object.entries(EnumObject).reduce(
    (acc, [key, value]) => {
      acc[value as T[keyof T]] = key as keyof T;
      return acc;
    },
    {} as Record<T[keyof T], keyof T>
  );
}