|
1 | 1 | (function (global, factory) { |
2 | | - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch'), require('os')) : |
3 | | - typeof define === 'function' && define.amd ? define(['isomorphic-unfetch', 'os'], factory) : |
4 | | - (global.cep = factory(global.fetch,global.os)); |
5 | | -}(this, (function (fetch,os) { 'use strict'; |
| 2 | + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch')) : |
| 3 | + typeof define === 'function' && define.amd ? define(['isomorphic-unfetch'], factory) : |
| 4 | + (global.cep = factory(global.fetch)); |
| 5 | +}(this, (function (fetch) { 'use strict'; |
6 | 6 |
|
7 | 7 | fetch = fetch && fetch.hasOwnProperty('default') ? fetch['default'] : fetch; |
8 | 8 |
|
@@ -283,27 +283,20 @@ function throwApplicationError$2(error) { |
283 | 283 | throw serviceError; |
284 | 284 | } |
285 | 285 |
|
| 286 | +/* istanbul ignore next */ |
286 | 287 | function isBrowser() { |
287 | 288 | return typeof window !== 'undefined'; |
288 | 289 | } |
289 | 290 |
|
290 | | -function isHttps() { |
291 | | - return typeof location !== 'undefined' && location.protocol === 'https:'; |
292 | | -} |
293 | | - |
294 | | -function shouldUseProxy() { |
295 | | - return isBrowser() && !isHttps(); |
296 | | -} |
297 | | - |
298 | 291 | /* istanbul ignore next */ |
299 | 292 | function injectProxy(Service) { |
300 | 293 | return function (cepWithLeftPad) { |
301 | 294 | return Service(cepWithLeftPad, PROXY_URL); |
302 | 295 | }; |
303 | 296 | } |
304 | 297 |
|
305 | | -var CepAbertoService = shouldUseProxy() ? injectProxy(fetchCepAbertoService) : fetchCepAbertoService; |
306 | | -var CorreiosService = shouldUseProxy() ? injectProxy(fetchCorreiosService) : fetchCorreiosService; |
| 298 | +var CepAbertoService = isBrowser() ? injectProxy(fetchCepAbertoService) : fetchCepAbertoService; |
| 299 | +var CorreiosService = isBrowser() ? injectProxy(fetchCorreiosService) : fetchCorreiosService; |
307 | 300 | var ViaCepService = fetchViaCepService; |
308 | 301 |
|
309 | 302 | var reverse = function reverse(promise) { |
|
0 commit comments