From 658cceaadb78033c4b39128730029eef77d637ce Mon Sep 17 00:00:00 2001 From: Kayo Kallas Date: Tue, 19 May 2020 09:56:41 -0700 Subject: [PATCH] Update getPacket utility method (#105) --- ait/gui/static/js/ait/util.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ait/gui/static/js/ait/util.js b/ait/gui/static/js/ait/util.js index d6b3443b..99197bd0 100644 --- a/ait/gui/static/js/ait/util.js +++ b/ait/gui/static/js/ait/util.js @@ -37,10 +37,23 @@ function move (array, from, to) { } /** - * + * Returns DN to EU value if it exists unless the `raw` parameter is true, + * otherwise return raw value. */ -function getPacket (data, dntoeu) { - return dntoeu ? data['dntoeu']:data['raw'] +function getPacket (data, raw=false) { + let value = undefined + + if (!data['dntoeu']){ + value = data['raw'] + } + else if (data['dntoeu'] && raw) { + value = data['raw'] + } + else { + value = data['dntoeu'] + } + + return value } export { merge, move, getPacket }