Skip to content

Commit

Permalink
second tweak to buildMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Apr 18, 2024
1 parent 97c912d commit fbb2c7e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/stringMsg.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const {
* @param {Object} [rest={}] Anything else to be added like len, timestamp, direction.
* @return {Object} All canId fields with format and data props added.
*/
function buildMsg(canIdInfo, format, data, rest = {}) {
canIdInfo.format = canIdInfo.format ? canIdInfo.format : format
canIdInfo.data = canIdInfo.data ? canIdInfo.data : data
function buildMsg(_canIdInfo, format, data, rest = {}) {
const canIdInfo = Object.assign({}, _canIdInfo, {
format,
data
})
for (const property in rest) {
if (canIdInfo[property] === undefined) {
canIdInfo[property] = rest[property]
Expand Down

0 comments on commit fbb2c7e

Please sign in to comment.