Last active
May 4, 2021 09:16
-
-
Save fjcunha/b8d0e34e80ba6279ff81c9000d094c74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrazilRegion | |
{ | |
constructor() { | |
this.States = [ | |
{ | |
Uf:'RO', | |
Name:'Rondônia' | |
}, | |
{ | |
Uf:'AC', | |
Name:'Acre' | |
}, | |
{ | |
Uf:'AM', | |
Name:'Amazonas' | |
}, | |
{ | |
Uf:'RR', | |
Name:'Roraima' | |
}, | |
{ | |
Uf:'PA', | |
Name:'Pará' | |
}, | |
{ | |
Uf:'AP', | |
Name:'Amapá' | |
}, | |
{ | |
Uf:'TO', | |
Name:'Tocantins' | |
}, | |
{ | |
Uf:'MA', | |
Name:'Maranhão' | |
}, | |
{ | |
Uf:'PI', | |
Name:'Piauí' | |
}, | |
{ | |
Uf:'CE', | |
Name:'Ceará' | |
}, | |
{ | |
Uf:'RN', | |
Name:'Rio Grande do Norte' | |
}, | |
{ | |
Uf:'PB', | |
Name:'Paraíba' | |
}, | |
{ | |
Uf:'PE', | |
Name:'Pernambuco' | |
}, | |
{ | |
Uf:'AL', | |
Name:'Alagoas' | |
}, | |
{ | |
Uf:'SE', | |
Name:'Sergipe' | |
}, | |
{ | |
Uf:'BA', | |
Name:'Bahia' | |
}, | |
{ | |
Uf:'Minas Gerais', | |
Name:'MG' | |
}, | |
{ | |
Uf:'Espírito Santo', | |
Name:'ES' | |
}, | |
{ | |
Uf:'RJ', | |
Name:'Rio de Janeiro' | |
}, | |
{ | |
Uf:'SP', | |
Name:'São Paulo' | |
}, | |
{ | |
Uf:'PR', | |
Name:'Paraná' | |
}, | |
{ | |
Uf:'SC', | |
Name:'Santa Catarina' | |
}, | |
{ | |
Uf:'RS', | |
Name:'Rio Grande do Sul' | |
}, | |
{ | |
Uf:'MS', | |
Name:'Mato Grosso do Sul' | |
}, | |
{ | |
Uf:'MT', | |
Name:'Mato Grosso' | |
}, | |
{ | |
Uf:'GO', | |
Name:'Goiás' | |
}, | |
{ | |
Uf:'DF', | |
Name:'Distrito Federal' | |
} | |
]; | |
this.PostalRegions = [ | |
{ | |
CEPInits:0, | |
Name:'Grande São Paulo', | |
Ufs:['SP'] | |
}, | |
{ | |
CEPInits:1, | |
Name:'Interior São Paulo', | |
Ufs:['SP'] | |
}, | |
{ | |
CEPInits:2, | |
Name:'Rio de Janeiro e Espírito Santo', | |
Ufs:['RJ','ES'] | |
}, | |
{ | |
CEPInits:3, | |
Name:'Minas Gerais', | |
Ufs:['MG'] | |
}, | |
{ | |
CEPInits:4, | |
Name:'Bahia e Sergipe', | |
Ufs:['BA','SE'] | |
}, | |
{ | |
CEPInits:5, | |
Name:'Pernambuco, Alagoas, Paraíba e Rio Grande do Norte', | |
Ufs:['PE','AL','PB','RN'] | |
}, | |
{ | |
CEPInits:6, | |
Name:'Ceará, Piauí, Maranhão, Pará, Amazonas, Acre, Amapá e Roraima', | |
Ufs:['CE','PI','MA','PA','AM','AC','AP','RR'] | |
}, | |
{ | |
CEPInits:7, | |
Name:'Distrito Federal, Goiás, Tocantins, Mato Grosso, Mato Grosso do Sul e Rondônia', | |
Ufs:['DF','GO','TO','MT','MS','RO'] | |
}, | |
{ | |
CEPInits:8, | |
Name:'Paraná e Santa Catarina', | |
Ufs:['PR','SC'] | |
}, | |
{ | |
CEPInits:9, | |
Name:'Rio Grande do Sul', | |
Ufs:['RS'] | |
}, | |
]; | |
this.RegionStates = [ | |
{ | |
name:'Centro-Oeste', | |
ufs:['GO','MT','MS','DF'] | |
}, | |
{ | |
name:'Norte', | |
ufs:['AC','AM','RR','RO','PA','AP','TO'] | |
}, | |
{ | |
name:'Nordeste', | |
ufs:['AL','BA','CE','MA','PI','PE','PB','RN','SE'] | |
}, | |
{ | |
name:'Sul', | |
ufs:['PR','SC','RS'] | |
}, | |
{ | |
name:'Sudeste', | |
ufs:['ES','RJ','SP','MG'] | |
} | |
]; | |
} | |
GetRegionByUF(uf) { | |
return this.RegionStates.find(x => x.ufs.find(y => y == uf) != null).name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment