Skip to content

Commit 88938ab

Browse files
committed
chore: bump dist
1 parent 5f66f79 commit 88938ab

File tree

4 files changed

+34
-48
lines changed

4 files changed

+34
-48
lines changed

dist/cep-promise-browser.js

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -584,27 +584,25 @@
584584
throw serviceError;
585585
}
586586

587-
var PROXY_URL = 'https://proxier.now.sh/api?url=';
588-
589-
/* istanbul ignore next */
590-
591-
function isBrowser() {
592-
return typeof window !== 'undefined';
593-
}
594-
/* istanbul ignore next */
595-
587+
function getAvailableServices() {
588+
var isBrowser = typeof window !== 'undefined';
589+
590+
if (isBrowser) {
591+
return {
592+
brasilapi: fetchBrasilAPIService,
593+
viacep: fetchViaCepService,
594+
widenet: fetchWideNetService
595+
};
596+
}
596597

597-
function injectProxy(Service) {
598-
return function (cepWithLeftPad) {
599-
return Service(cepWithLeftPad, PROXY_URL);
598+
return {
599+
brasilapi: fetchBrasilAPIService,
600+
viacep: fetchViaCepService,
601+
widenet: fetchWideNetService,
602+
correios: fetchCorreiosService
600603
};
601604
}
602605

603-
var CorreiosService = isBrowser() ? injectProxy(fetchCorreiosService) : fetchCorreiosService;
604-
var ViaCepService = fetchViaCepService;
605-
var WideNetService = fetchWideNetService;
606-
var BrasilAPIService = fetchBrasilAPIService;
607-
608606
var reverse = function reverse(promise) {
609607
return new Promise(function (resolve, reject) {
610608
return Promise.resolve(promise).then(reject, resolve);
@@ -711,12 +709,7 @@
711709
}
712710

713711
function fetchCepFromServices(cepWithLeftPad, configurations) {
714-
var providersServices = {
715-
brasilapi: BrasilAPIService,
716-
viacep: ViaCepService,
717-
widenet: WideNetService,
718-
correios: CorreiosService
719-
};
712+
var providersServices = getAvailableServices();
720713

721714
if (configurations.providers.length === 0) {
722715
return Promise$1.any(Object.values(providersServices).map(function (provider) {

0 commit comments

Comments
 (0)