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
const validate_cep = (cep) => { | |
cep = cep.replace(/[^0-9]/gi, ""); | |
if (cep.length == 8) { | |
return cep; | |
} | |
throw `CEP "${cep}" format invalid` | |
} | |
const apiCep = (cep) => `https://api.findcep.com/v1/cep/${cep}.json` | |
let cep_search = validate_cep('01001-001'); |