tools: fix nits in tools/doc/type-parser.js
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Style nits:
- Remove redundant variable.
- Rename and regroup variables for consistency.
- Rearrange export to reduce indentation level (unnecessarily increases diff, unfortunately).
- Replace common function by arrow function in
.forEach()
argument. - Replace
.indexOf()
with.includes()
. - Unify string concatenation, replace with template strings.
HTML nit:
- Remove extra line break in the output (reduces overall docs size by 78 KB).
Logic nit:
- Throw when type slot is empty (on things like
{ }
,{ | type }
,{ type | }
).