Skip to content

Instantly share code, notes, and snippets.

View findcep.js
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');
You can’t perform that action at this time.