MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / postprocess

Function postprocess

packages/ast/postprocess/index.js:15–30  ·  view source on GitHub ↗
(message, allUsers)

Source from the content-addressed store, hash-verified

13}
14
15const 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
32module.exports = postprocess;

Callers 6

EditThreadModalFunction · 0.90
AddThreadModalFunction · 0.90
EditMessageModalFunction · 0.90
handleSubmitFunction · 0.90
MessageFormFunction · 0.90
ChatFunction · 0.90

Calls 4

walkFunction · 0.85
stringifyFunction · 0.85
getTagFunction · 0.70
findMethod · 0.45

Tested by

no test coverage detected