Skip to content

Commit 8237984

Browse files
committed
optimize fetchApi selector
1 parent 4b4683f commit 8237984

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 7.0.3
2+
3+
- optimize fetchApi selector
4+
15
### 7.0.2
26

37
- fix getOptions to return reference language in the supportedLngs if there are no languages found yet

i18nextLocizeBackend.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,11 @@ exports.default = void 0;
662662
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
663663
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
664664
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
665-
var fetchApi;
666-
if (typeof fetch === 'function') {
667-
if (typeof global !== 'undefined' && global.fetch) {
668-
fetchApi = global.fetch;
669-
} else if (typeof window !== 'undefined' && window.fetch) {
670-
fetchApi = window.fetch;
671-
} else {
672-
fetchApi = fetch;
673-
}
665+
var fetchApi = typeof fetch === 'function' ? fetch : undefined;
666+
if (typeof global !== 'undefined' && global.fetch) {
667+
fetchApi = global.fetch;
668+
} else if (typeof window !== 'undefined' && window.fetch) {
669+
fetchApi = window.fetch;
674670
}
675671
var XmlHttpRequestApi;
676672
if (typeof XMLHttpRequest === 'function' || (typeof XMLHttpRequest === "undefined" ? "undefined" : _typeof(XMLHttpRequest)) === 'object') {

0 commit comments

Comments
 (0)