From 92dba5274efd6934cb20a2a44b0b506a44af50df Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Fri, 8 Mar 2019 21:48:21 -0500 Subject: [PATCH] improving browser detection --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ca4dcdf..fb5108e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/secure-file-wrapper", - "version": "2.3.3", + "version": "2.3.4", "main": "lib/index.js", "author": "Fabian Stamm ", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index c3ef6e3..7addd70 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { Observable, Lock } from "@hibas123/utils"; //this references global on node and window in browser -const fetch = this.fetch ? this.fetch : require("cross-fetch").default; +const fetch = typeof window !== "undefined" && typeof window.fetch !== undefined ? window.fetch : require("cross-fetch").default; export interface IFileVersion { version: string;