Post ANN0mBw78M6yMhnY8W by norm@misskey.biribiri.dev
(DIR) More posts by norm@misskey.biribiri.dev
(DIR) Post #ANMrzAC01sCf8NL5OK by norm@misskey.biribiri.dev
2022-09-08T22:04:36.971Z
0 likes, 0 repeats
really tempted to just replace this with a giant switch block
(DIR) Post #ANMrzAr7Yz63BuZvUG by wolf480pl@mstdn.io
2022-09-08T22:09:37Z
0 likes, 0 repeats
@norm idk the code looks good to me...
(DIR) Post #ANMsArvnkYcfyNLOwC by wolf480pl@mstdn.io
2022-09-08T22:11:43Z
0 likes, 0 repeats
@norm except for that map jnside of for... if this language doesn't allow you to children.map().foreach() then I'd instead do:for ( c of children ) targetElement.appendChild(handlers[c.type][c]())
(DIR) Post #ANMsUBshnfydLh6qR6 by norm@misskey.biribiri.dev
2022-09-08T22:10:43.842Z
0 likes, 0 repeats
@wolf480pl@mstdn.io probably should have shown the whole file: https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/f50b31b84775b7f7ec6dc122685347257b0003b7/packages/backend/src/mfm/to-html.ts
(DIR) Post #ANMsUCHsI66sbkswfQ by wolf480pl@mstdn.io
2022-09-08T22:14:46Z
0 likes, 0 repeats
@norm IMO it's fine. A switch would be less clean.
(DIR) Post #ANMscyQtAgYWFFHpFA by wolf480pl@mstdn.io
2022-09-08T22:16:50Z
0 likes, 0 repeats
@norm like, most of the code is in the handlers, so it should be a priority that the handlers are readable and convenient to write. If that means appendChildren, which is 5 lines of code, is slightly tricky, that's a good tradeoff IMO
(DIR) Post #ANMssUSaNPW5v5TlRo by wolf480pl@mstdn.io
2022-09-08T22:19:38Z
0 likes, 0 repeats
@norm depending on language, maybe I'd try to deduplicate the createElement calls, but idk if typescript has a convenient way to do it...
(DIR) Post #ANMt0wSMAegX47Oyq8 by wolf480pl@mstdn.io
2022-09-08T22:21:10Z
0 likes, 0 repeats
@norm and maybe make appendChildren return targetElement so that handlers can return appendChildren(...) but that's just hair splitting
(DIR) Post #ANMwouRUEUsZA1VrdY by norm@misskey.biribiri.dev
2022-09-08T22:35:51.468Z
0 likes, 0 repeats
@wolf480pl@mstdn.io I'll just take a break from this and probably think about it some more at a later time
(DIR) Post #ANMwoumOyjbqCtIZEm by wolf480pl@mstdn.io
2022-09-08T23:03:49Z
0 likes, 0 repeats
@norm wait those yellow underscores are type errors?
(DIR) Post #ANMz3LbWF5lxMdDZOS by tusooa@kazv.moe
2022-09-08T23:28:49.374432Z
0 likes, 0 repeats
@norm useless use of if
(DIR) Post #ANN0mBw78M6yMhnY8W by norm@misskey.biribiri.dev
2022-09-08T23:38:19.681Z
2 likes, 0 repeats
@tusooa@kazv.moe probably overly cautious, could be removed without issues