From 2f713fed0b6cb8abe7092477cd6f7047e049382b Mon Sep 17 00:00:00 2001 From: Justus Fluegel Date: Mon, 23 Nov 2020 17:01:22 +0100 Subject: [PATCH] remove null-coalescing-operator for backwards compatibility --- hydra-cli.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hydra-cli.js b/hydra-cli.js index 8f5d382..c7bf27b 100755 --- a/hydra-cli.js +++ b/hydra-cli.js @@ -12,6 +12,9 @@ const UMFMessage = hydra.getUMFMessageHelper(); const CONFIG_FILE_VERSION = 2; +// Works like the es2020 ?? operator +const nCoalescg = (...args) => args.find((el) => el != null && el != undefined); + /** * @name Program */ @@ -626,7 +629,7 @@ class Program { }); hydra.makeAPIRequest(msg) .then((res) => { - if ((res.payLoad ?? res) == undefined) { + if (nCoalescg(res.payLoad, res) == undefined) { console.trace(`Error parsing response from service.`); this.exitApp(); return; @@ -666,7 +669,7 @@ class Program { }); hydra.makeAPIRequest(msg) .then((res) => { - if ((res.payLoad ?? res) == undefined) { + if (nCoalescg(res.payLoad, res) == undefined) { console.trace(`Error parsing response from service.`); this.exitApp(); return;