Skip to content

Commit 90200a5

Browse files
chore: update build files
1 parent 97cddc5 commit 90200a5

File tree

4 files changed

+20
-67
lines changed

4 files changed

+20
-67
lines changed

dist/cep-promise-browser.js

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
(function (global, factory) {
2-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3-
typeof define === 'function' && define.amd ? define(factory) :
4-
(global = global || self, global.cep = factory());
5-
}(this, (function () { 'use strict';
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('unfetch')) :
3+
typeof define === 'function' && define.amd ? define(['unfetch'], factory) :
4+
(global = global || self, global.cep = factory(global.fetch));
5+
}(this, (function (fetch) { 'use strict';
6+
7+
fetch = fetch && Object.prototype.hasOwnProperty.call(fetch, 'default') ? fetch['default'] : fetch;
68

79
function _typeof(obj) {
810
"@babel/helpers - typeof";
@@ -276,57 +278,6 @@
276278
return CepPromiseError;
277279
}( /*#__PURE__*/_wrapNativeSuper(Error));
278280

279-
function fetch (e, n) {
280-
return n = n || {}, new Promise(function (t, r) {
281-
var s = new XMLHttpRequest(),
282-
o = [],
283-
u = [],
284-
i = {},
285-
a = function a() {
286-
return {
287-
ok: 2 == (s.status / 100 | 0),
288-
statusText: s.statusText,
289-
status: s.status,
290-
url: s.responseURL,
291-
text: function text() {
292-
return Promise.resolve(s.responseText);
293-
},
294-
json: function json() {
295-
return Promise.resolve(JSON.parse(s.responseText));
296-
},
297-
blob: function blob() {
298-
return Promise.resolve(new Blob([s.response]));
299-
},
300-
clone: a,
301-
headers: {
302-
keys: function keys() {
303-
return o;
304-
},
305-
entries: function entries() {
306-
return u;
307-
},
308-
get: function get(e) {
309-
return i[e.toLowerCase()];
310-
},
311-
has: function has(e) {
312-
return e.toLowerCase() in i;
313-
}
314-
}
315-
};
316-
};
317-
318-
for (var l in s.open(n.method || "get", e, !0), s.onload = function () {
319-
s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (e, n, t) {
320-
o.push(n = n.toLowerCase()), u.push([n, t]), i[n] = i[n] ? i[n] + "," + t : t;
321-
}), t(a());
322-
}, s.onerror = r, s.withCredentials = "include" == n.credentials, n.headers) {
323-
s.setRequestHeader(l, n.headers[l]);
324-
}
325-
326-
s.send(n.body || null);
327-
});
328-
}
329-
330281
var ServiceError = /*#__PURE__*/function (_Error) {
331282
_inherits(ServiceError, _Error);
332283

@@ -441,7 +392,8 @@
441392
method: 'GET',
442393
mode: 'cors',
443394
headers: {
444-
'content-type': 'application/json;charset=utf-8'
395+
'content-type': 'application/json;charset=utf-8',
396+
'user-agent': ''
445397
}
446398
};
447399
return fetch(url, options).then(analyzeAndParseResponse$1).then(checkForViaCepError).then(extractCepValuesFromResponse)["catch"](throwApplicationError$1);
@@ -589,17 +541,17 @@
589541

590542
if (isBrowser) {
591543
return {
592-
brasilapi: fetchBrasilAPIService,
593544
viacep: fetchViaCepService,
594-
widenet: fetchWideNetService
545+
widenet: fetchWideNetService,
546+
brasilapi: fetchBrasilAPIService
595547
};
596548
}
597549

598550
return {
599-
brasilapi: fetchBrasilAPIService,
551+
correios: fetchCorreiosService,
600552
viacep: fetchViaCepService,
601553
widenet: fetchWideNetService,
602-
correios: fetchCorreiosService
554+
brasilapi: fetchBrasilAPIService
603555
};
604556
}
605557

0 commit comments

Comments
 (0)