Skip to content

Commit 6467239

Browse files
committed
chore: bump dist and package version
1 parent 47b2dba commit 6467239

File tree

6 files changed

+1840
-1059
lines changed

6 files changed

+1840
-1059
lines changed

dist/cep-promise-browser.js

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -73,47 +73,37 @@ var CepPromiseError = function (_Error) {
7373
return CepPromiseError;
7474
}(Error);
7575

76-
function unfetch (e, n) {
76+
function fetch (e, n) {
7777
return n = n || {}, new Promise(function (t, r) {
78-
var s = new XMLHttpRequest(),
79-
o = [],
80-
u = [],
81-
i = {},
82-
a = function a() {
83-
return { ok: 2 == (s.status / 100 | 0), statusText: s.statusText, status: s.status, url: s.responseURL, text: function text() {
78+
var s = new XMLHttpRequest();for (var o in s.open(n.method || "get", e, !0), n.headers) {
79+
s.setRequestHeader(o, n.headers[o]);
80+
}function u() {
81+
var e,
82+
n = [],
83+
t = [],
84+
r = {};return s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (s, o, u) {
85+
n.push(o = o.toLowerCase()), t.push([o, u]), r[o] = (e = r[o]) ? e + "," + u : u;
86+
}), { ok: 2 == (s.status / 100 | 0), status: s.status, statusText: s.statusText, url: s.responseURL, clone: u, text: function text() {
8487
return Promise.resolve(s.responseText);
8588
}, json: function json() {
86-
return Promise.resolve(JSON.parse(s.responseText));
89+
return Promise.resolve(s.responseText).then(JSON.parse);
8790
}, blob: function blob() {
8891
return Promise.resolve(new Blob([s.response]));
89-
}, clone: a, headers: { keys: function keys() {
90-
return o;
92+
}, headers: { keys: function keys() {
93+
return n;
9194
}, entries: function entries() {
92-
return u;
95+
return t;
9396
}, get: function get(e) {
94-
return i[e.toLowerCase()];
97+
return r[e.toLowerCase()];
9598
}, has: function has(e) {
96-
return e.toLowerCase() in i;
99+
return e.toLowerCase() in r;
97100
} } };
98-
};for (var l in s.open(n.method || "get", e, !0), s.onload = function () {
99-
s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (e, n, t) {
100-
o.push(n = n.toLowerCase()), u.push([n, t]), i[n] = i[n] ? i[n] + "," + t : t;
101-
}), t(a());
102-
}, s.onerror = r, s.withCredentials = "include" == n.credentials, n.headers) {
103-
s.setRequestHeader(l, n.headers[l]);
104-
}s.send(n.body || null);
101+
}s.withCredentials = "include" == n.credentials, s.onload = function () {
102+
t(u());
103+
}, s.onerror = r, s.send(n.body || null);
105104
});
106105
}
107106

108-
109-
var unfetch$1 = Object.freeze({
110-
default: unfetch
111-
});
112-
113-
var require$$0 = ( unfetch$1 && unfetch ) || unfetch$1;
114-
115-
var browser = window.fetch || (window.fetch = require$$0.default || require$$0);
116-
117107
var ServiceError = function (_Error) {
118108
inherits(ServiceError, _Error);
119109

@@ -148,7 +138,7 @@ function fetchCorreiosService(cepWithLeftPad) {
148138
}
149139
};
150140

151-
return browser(url, options).then(analyzeAndParseResponse).catch(throwApplicationError);
141+
return fetch(url, options).then(analyzeAndParseResponse).catch(throwApplicationError);
152142
}
153143

154144
function analyzeAndParseResponse(response) {
@@ -226,7 +216,7 @@ function fetchViaCepService(cepWithLeftPad) {
226216
}
227217
};
228218

229-
return browser(url, options).then(analyzeAndParseResponse$1).then(checkForViaCepError).then(extractCepValuesFromResponse).catch(throwApplicationError$1);
219+
return fetch(url, options).then(analyzeAndParseResponse$1).then(checkForViaCepError).then(extractCepValuesFromResponse).catch(throwApplicationError$1);
230220
}
231221

232222
function analyzeAndParseResponse$1(response) {
@@ -280,7 +270,7 @@ function fetchWideNetService(cepWithLeftPad) {
280270
}
281271
};
282272

283-
return browser(url, options).then(analyzeAndParseResponse$2).then(checkForWideNetError).then(extractCepValuesFromResponse$1).catch(throwApplicationError$2);
273+
return fetch(url, options).then(analyzeAndParseResponse$2).then(checkForWideNetError).then(extractCepValuesFromResponse$1).catch(throwApplicationError$2);
284274
}
285275

286276
function analyzeAndParseResponse$2(response) {

dist/cep-promise-browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cep-promise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function (global, factory) {
2-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch')) :
3-
typeof define === 'function' && define.amd ? define(['isomorphic-unfetch'], factory) :
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('node-fetch')) :
3+
typeof define === 'function' && define.amd ? define(['node-fetch'], factory) :
44
(global.cep = factory(global.fetch));
55
}(this, (function (fetch) { 'use strict';
66

0 commit comments

Comments
 (0)