Undefined should be valid value for first element of sub-arrays
adius opened this issue · comments
Moved to @ad-si commented
Deleted user commented
I assume this is for things like
['div#pagination', [
renderPrev(),
renderNext()
]]
Where renderPrev()
might return undefined
if there is no Prev button to display. I.e., the user is already on page 1.
What other circumstance would undefined
be OK?
Moved to @ad-si commented
I was just about to implement this, but realized this is maybe not a good idea
as it's not clear if it's really supposed to be a sub-array.
E.g. Was this
['article',
[
undefined,
['p'],
['p']
]
]
supposed to mean
['article',
[
['p'],
['p'],
['p']
]
]
or
['article',
['section',
['p'],
['p']
]
]
I'd rather think option 2. So the undefined
should be an error.
If one wants to make sure that the array contains no undefined
,
it can simply be prevented with array.filter(element => Boolean(element))