import { macroRegions , regions } from './autogen.partition' ; type ArrayMap = { [ x ] : string [ ] ; } ; const buildArrayMap = ( raw ) : ArrayMap => { const res = { } ; raw . split ( '|' ) . forEach ( ( e ) => { const [ k , vs ] = e . split ( ':' ) ; res [ k ] = vs . split ( '' ) ; } ) ; return res ; } ; let regionToPartition ; let macroRegionToPartitions ; const init = ( ) => { regionToPartition = buildArrayMap ( regions ) ; macroRegionToPartitions = buildArrayMap ( macroRegions ) ; } ; export const getRegionPartition = ( region ) : string [ ] => { if ( ! regionToPartition ) { init ( ) ; } const result = regionToPartition ! [ region ] || macroRegionToPartitions ! [ region ] ; return result === undefined ? [ ] : result ; } ;