normalizeArrayChildren() — vue Function Reference
Architecture documentation for the normalizeArrayChildren() function in normalize-children.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 1440068e_e497_905d_990b_b0c74b435762["normalizeArrayChildren()"] 5622921f_54b9_3c35_daaf_e1a5562f01a0["normalizeChildren()"] 5622921f_54b9_3c35_daaf_e1a5562f01a0 -->|calls| 1440068e_e497_905d_990b_b0c74b435762 a1f5b8ca_b6d5_6b24_155e_038685c97c85["isUndef()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| a1f5b8ca_b6d5_6b24_155e_038685c97c85 0a88c863_3ff3_571a_18d8_dde5273c2b77["isTextNode()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| 0a88c863_3ff3_571a_18d8_dde5273c2b77 92963bf0_2970_d7e2_456b_fc4a902c8b11["createTextVNode()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| 92963bf0_2970_d7e2_456b_fc4a902c8b11 7ce22b46_ffa0_d052_2b70_6ef17b86c493["isPrimitive()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| 7ce22b46_ffa0_d052_2b70_6ef17b86c493 7b3aa424_9089_4803_a4c7_86c4f80ba973["isTrue()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| 7b3aa424_9089_4803_a4c7_86c4f80ba973 2be3818d_a4f3_495c_543c_ee071b428982["isDef()"] 1440068e_e497_905d_990b_b0c74b435762 -->|calls| 2be3818d_a4f3_495c_543c_ee071b428982 style 1440068e_e497_905d_990b_b0c74b435762 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