(message, allUsers)
| 13 | } |
| 14 | |
| 15 | const postprocess = (message, allUsers) => { |
| 16 | const tree = parse.linen(message); |
| 17 | walk(tree, (node) => { |
| 18 | if (node.type === 'user' || node.type === 'signal') { |
| 19 | const user = allUsers.find((user) => user.username === node.id); |
| 20 | if (user) { |
| 21 | node.source = `${getTag(node.type)}${user.id}`; |
| 22 | node.id = user.id; |
| 23 | } else { |
| 24 | node.type = 'text'; |
| 25 | node.value = node.source.substr(1); |
| 26 | } |
| 27 | } |
| 28 | }); |
| 29 | return stringify(tree); |
| 30 | }; |
| 31 | |
| 32 | module.exports = postprocess; |
no test coverage detected