MCPcopy Index your code
hub / github.com/TruthHun/BookStack / normalizeArrayChildren

Function normalizeArrayChildren

static/vuejs/vue.runtime.esm.js:1763–1793  ·  view source on GitHub ↗
(children, nestedIndex)

Source from the content-addressed store, hash-verified

1761}
1762
1763function normalizeArrayChildren (children, nestedIndex) {
1764 var res = [];
1765 var i, c, last;
1766 for (i = 0; i < children.length; i++) {
1767 c = children[i];
1768 if (c == null || typeof c === 'boolean') { continue }
1769 last = res[res.length - 1];
1770 // nested
1771 if (Array.isArray(c)) {
1772 res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
1773 } else if (isPrimitive(c)) {
1774 if (last && last.text) {
1775 last.text += String(c);
1776 } else if (c !== '') {
1777 // convert primitive to vnode
1778 res.push(createTextVNode(c));
1779 }
1780 } else {
1781 if (c.text && last && last.text) {
1782 res[res.length - 1] = createTextVNode(last.text + c.text);
1783 } else {
1784 // default key for nested array children (likely generated by v-for)
1785 if (c.tag && c.key == null && nestedIndex != null) {
1786 c.key = "__vlist" + nestedIndex + "_" + i + "__";
1787 }
1788 res.push(c);
1789 }
1790 }
1791 }
1792 return res
1793}
1794
1795/* */
1796

Callers 1

normalizeChildrenFunction · 0.70

Calls 2

isPrimitiveFunction · 0.70
createTextVNodeFunction · 0.70

Tested by

no test coverage detected