Empty children arrays #1
Labels
🗄 area/interface
This affects the public interface
💪 phase/solved
Post is done
👶 semver/patch
This is a backwards-compatible fix
🐛 type/bug
This is a problem
This is a question and a suggestion regarding this part of Unist readme (emphasis mine):
I read it as “Unist nodes may have a
children
property, in which case it is guaranteed that its length is ≥1”. If this is correct, then it follows that both retext, mdast, and hast violate this specification by producing trees with emptychildren
arrays:If I haven't missed anything then I guess this requirement should be relaxed to include empty
children
(or removed if it doesn't require anything) or, alternatively,retext
,mdast
, andhast
should be fixed to never output nodes with emptychildren
arrays. The latter seems more problematic (the obvious workaround is returningnull
on empty input but I feel that it's better for parsers to always output a valid syntax tree) so I opened the issue here.The text was updated successfully, but these errors were encountered: