Is there anyway to escape the foreach loop with
if (!o && !o.children){ return;}
Here is the original index.js:
vdom.children.forEach(mapGroup => {
// All children should be Mithril virtual group nodes "[" but we'll make sure no `null` or `undefined` got in here
if (!mapGroup || !mapGroup.children) {
return;
}
// Clone array so inserting new items into the original array doesn't cause the loop to skip items
[...mapGroup.children].forEach((li) => {
// Verify each child is an li containing a DiscussionListItem, this way we are not counting items added by other extensions
if (li.tag !== 'li' || !li.children || !li.children.length || !li.children[0] || li.children[0].tag !== DiscussionListItem) {
return;
}
Then the compilation result (forum.js):
o.children.forEach(function (o) {
o &&
o.children &&
[].concat(o.children).forEach(function (e) {
"li" === e.tag &&
e.children &&
e.children.length &&
e.children[0] &&
e.children[0].tag === i() &&
((e.attrs["data-index"] = s),
0 === s
It appears null
or undefined
still gets through and presents the console log error above.