All files / constants regions.ts

78.26% Statements 18/23
26.67% Branches 4/15
66.67% Functions 2/3
78.26% Lines 18/23

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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 443x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x     3x 3x 3x 3x     3x                                            
export enum Regions {
  BRAZIL = 'BR1',
  EU_EAST = 'EUN1',
  EU_WEST = 'EUW1',
  KOREA = 'KR',
  LAT_NORTH = 'LA1',
  LAT_SOUTH = 'LA2',
  AMERICA_NORTH = 'NA1',
  OCEANIA = 'OC1',
  TURKEY = 'TR1',
  RUSSIA = 'RU',
  JAPAN = 'JP1',
  PBE = 'PBE1'
}
 
export enum TftRegions {
  EUROPE = 'europe',
  ASIA = 'asia',
  AMERICAS = 'americas'
}
 
export function regionToTftRegions (region: Regions): TftRegions {
  switch (region) {
    // America
    case Regions.AMERICA_NORTH:
    case Regions.BRAZIL:
    case Regions.LAT_NORTH:
    case Regions.LAT_SOUTH:
    case Regions.OCEANIA:
      return TftRegions.AMERICAS
    // Europe
    case Regions.EU_EAST:
    case Regions.EU_WEST:
    case Regions.TURKEY:
    case Regions.RUSSIA:
      return TftRegions.EUROPE
    // Asia
    case Regions.JAPAN:
    case Regions.KOREA:
      return TftRegions.ASIA
  }
  throw new Error(`Unexpected region: ${region}`)
}