normalizeArrayChildren() — vue Function Reference
Architecture documentation for the normalizeArrayChildren() function in normalize-children.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 242e8703_557d_b7a4_e1e5_d4b525f65345["normalizeArrayChildren()"] 00cce470_87b6_9803_7f03_3dd6786130a1["normalizeChildren()"] 00cce470_87b6_9803_7f03_3dd6786130a1 -->|calls| 242e8703_557d_b7a4_e1e5_d4b525f65345 299f2646_f776_9b7d_1179_7b9087b1e66c["isUndef()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| 299f2646_f776_9b7d_1179_7b9087b1e66c 729ace3b_d81a_80e6_ed78_6dc1387038a5["isTextNode()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| 729ace3b_d81a_80e6_ed78_6dc1387038a5 095748dd_81f1_6e03_d155_904f85441616["createTextVNode()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| 095748dd_81f1_6e03_d155_904f85441616 587d6539_745c_96b2_3b45_56fbf8ca59e2["isPrimitive()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| 587d6539_745c_96b2_3b45_56fbf8ca59e2 c0051429_b95b_daa0_fc77_989c8344497d["isTrue()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| c0051429_b95b_daa0_fc77_989c8344497d 5b855538_2046_796e_16f9_7327a61399cb["isDef()"] 242e8703_557d_b7a4_e1e5_d4b525f65345 -->|calls| 5b855538_2046_796e_16f9_7327a61399cb style 242e8703_557d_b7a4_e1e5_d4b525f65345 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/vdom/helpers/normalize-children.ts lines 48–99
function normalizeArrayChildren(
children: any,
nestedIndex?: string
): Array<VNode> {
const res: VNode[] = []
let i, c, lastIndex, last
for (i = 0; i < children.length; i++) {
c = children[i]
if (isUndef(c) || typeof c === 'boolean') continue
lastIndex = res.length - 1
last = res[lastIndex]
// nested
if (isArray(c)) {
if (c.length > 0) {
c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`)
// merge adjacent text nodes
if (isTextNode(c[0]) && isTextNode(last)) {
res[lastIndex] = createTextVNode(last.text + c[0].text)
c.shift()
}
res.push.apply(res, c)
}
} else if (isPrimitive(c)) {
if (isTextNode(last)) {
// merge adjacent text nodes
// this is necessary for SSR hydration because text nodes are
// essentially merged when rendered to HTML strings
res[lastIndex] = createTextVNode(last.text + c)
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c))
}
} else {
if (isTextNode(c) && isTextNode(last)) {
// merge adjacent text nodes
res[lastIndex] = createTextVNode(last.text + c.text)
} else {
// default key for nested array children (likely generated by v-for)
if (
isTrue(children._isVList) &&
isDef(c.tag) &&
isUndef(c.key) &&
isDef(nestedIndex)
) {
c.key = `__vlist${nestedIndex}_${i}__`
}
res.push(c)
}
}
}
return res
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does normalizeArrayChildren() do?
normalizeArrayChildren() is a function in the vue codebase.
What does normalizeArrayChildren() call?
normalizeArrayChildren() calls 6 function(s): createTextVNode, isDef, isPrimitive, isTextNode, isTrue, isUndef.
What calls normalizeArrayChildren()?
normalizeArrayChildren() is called by 1 function(s): normalizeChildren.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free