All files / Rindu/utils locale.ts

100% Statements 7/7
100% Branches 3/3
100% Functions 2/2
100% Lines 6/6

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 15264x         4x 102x     76x 141x   99x    
export enum Locale {
  EN = "en",
  ES = "es",
}
 
export function isLocale(value: string): value is Locale {
  return Object.values(Locale).includes(value as Locale);
}
 
export function getLocale(value?: string | null): Locale {
  if (!value || !isLocale(value)) return Locale.EN;
 
  return value;
}