diff --git a/port/js/src/messgen.js b/port/js/src/messgen.js index 65afd66..36a188c 100644 --- a/port/js/src/messgen.js +++ b/port/js/src/messgen.js @@ -561,16 +561,17 @@ export function initializeMessages(messagesJson, headerSchema) { HEADER_STRUCT: headerSchema ? new Struct(headerSchema) : HEADER_STRUCT }; - for (let m in getKeysWithSortById(messagesJson)) { + for (let m of getKeysWithSortById(messagesJson)) { - let name = m.trim(), - msg = "MSG_" + name.toUpperCase(), - id = messagesJson[m].id; + let name = m.trim(), + messageObj = messagesJson[m], + msg = "MSG_" + name.toUpperCase(), + id = messageObj.id; - if (!res.__id__[id]) { - let msg_struct = new Struct(messagesJson[m], res); + if (!res.__id__[id]) { + let msg_struct = new Struct(messageObj, res); - res.__id__[id] = msg_struct; + res.__id__[id] = msg_struct; res.__name__[id] = m.trim(); res[msg] = msg_struct; res[name] = msg_struct;