How to use the cep-promise function in cep-promise

To help you get started, we’ve selected a few cep-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lianetoolkit / liane-toolkit / imports / api / facebook / people / server / peopleMethods.js View on Github external
run({ country, zipcode }) {
    this.unblock();

    switch (country) {
      case "BR":
        const match = zipcode.match(/\d+/gi);
        if (match && match.length) {
          const code = match.join("");
          if (code.length == 8) {
            return Promise.await(cep(code));
          }
        }
        return {};
      default:
        let res;
        let data = {};
        try {
          res = Promise.await(
            axios.get(`http://api.zippopotam.us/${country}/${zipcode}`)
          );
          data = res.data;
        } catch (e) {
          return data;
        } finally {
          if (data && data.places && data.places.length) {
            return {

cep-promise

Busca por CEP integrado diretamente aos serviços dos Correios e ViaCEP

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis

Popular cep-promise functions