@naturalcycles/js-lib 14.123.1 → 14.123.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,9 @@ const defRetryOptions = {
24
24
  */
25
25
  class Fetcher {
26
26
  constructor(cfg = {}) {
27
+ if (typeof globalThis.fetch !== 'function') {
28
+ throw new TypeError(`globalThis.fetch is not available`);
29
+ }
27
30
  this.cfg = this.normalizeCfg(cfg);
28
31
  // Dynamically create all helper methods
29
32
  http_model_1.HTTP_METHODS.forEach(method => {
@@ -22,6 +22,9 @@ const defRetryOptions = {
22
22
  */
23
23
  export class Fetcher {
24
24
  constructor(cfg = {}) {
25
+ if (typeof globalThis.fetch !== 'function') {
26
+ throw new TypeError(`globalThis.fetch is not available`);
27
+ }
25
28
  this.cfg = this.normalizeCfg(cfg);
26
29
  // Dynamically create all helper methods
27
30
  HTTP_METHODS.forEach(method => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.123.1",
3
+ "version": "14.123.2",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -187,6 +187,10 @@ const defRetryOptions: FetcherRetryOptions = {
187
187
  */
188
188
  export class Fetcher {
189
189
  private constructor(cfg: FetcherCfg & FetcherOptions = {}) {
190
+ if (typeof globalThis.fetch !== 'function') {
191
+ throw new TypeError(`globalThis.fetch is not available`)
192
+ }
193
+
190
194
  this.cfg = this.normalizeCfg(cfg)
191
195
 
192
196
  // Dynamically create all helper methods