All files / packages/design-system-2-site/src/lib icons.ts

100% Statements 5/5
100% Branches 12/12
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                  18x     3589x 3586x 3586x                      
export type Icon = {
  name: string;
  category: string;
  variant: string;
  synonyms: string[];
  svg: string;
};
 
export function isIconArray(value: unknown): value is Icon[] {
  return (
    Array.isArray(value) &&
    value.every((v) => {
      if (!v || typeof v !== 'object') return false;
      const i = v as Partial<Icon>;
      return (
        typeof i.name === 'string' &&
        typeof i.category === 'string' &&
        typeof i.variant === 'string' &&
        Array.isArray(i.synonyms) &&
        i.synonyms.every((s) => typeof s === 'string') &&
        typeof i.svg === 'string'
      );
    })
  );
}