mirror of
https://github.com/outline/outline.git
synced 2026-01-06 02:59:54 -06:00
19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
import { isUUID } from "validator";
|
|
import { IconType } from "../types";
|
|
import { IconLibrary } from "./IconLibrary";
|
|
|
|
const outlineIconNames = new Set(Object.keys(IconLibrary.mapping));
|
|
|
|
export const determineIconType = (
|
|
icon?: string | null
|
|
): IconType | undefined => {
|
|
if (!icon) {
|
|
return;
|
|
}
|
|
return outlineIconNames.has(icon)
|
|
? IconType.SVG
|
|
: isUUID(icon)
|
|
? IconType.Custom
|
|
: IconType.Emoji;
|
|
};
|