Skip to content

Commit

Permalink
Update getPacket utility method (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Futabay committed May 19, 2020
1 parent b89e233 commit 658ccea
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ait/gui/static/js/ait/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 658ccea

Please sign in to comment.