From a4b56c944ac313e279598bacba4c4224579009ea Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 17 Nov 2020 10:03:25 +0100 Subject: [PATCH] WKD: Fix "TypeError: fetch is not a function" in Node.js environment (#1181) --- src/wkd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wkd.js b/src/wkd.js index 39a90ea1..9a161ebd 100644 --- a/src/wkd.js +++ b/src/wkd.js @@ -31,7 +31,7 @@ import * as keyMod from './key'; * @constructor */ function WKD() { - this._fetch = typeof global !== 'undefined' ? global.fetch : require('node-fetch'); + this._fetch = typeof global.fetch === 'function' ? global.fetch : require('node-fetch'); } /**