MCPcopy
hub / github.com/msoedov/agentic_security / normalizeArrayChildren

Function normalizeArrayChildren

agentic_security/static/vue.js:2376–2422  ·  view source on GitHub ↗
(children, nestedIndex)

Source from the content-addressed store, hash-verified

2374 }
2375
2376 function normalizeArrayChildren (children, nestedIndex) {
2377 var res = [];
2378 var i, c, lastIndex, last;
2379 for (i = 0; i < children.length; i++) {
2380 c = children[i];
2381 if (isUndef(c) || typeof c === 'boolean') { continue }
2382 lastIndex = res.length - 1;
2383 last = res[lastIndex];
2384 // nested
2385 if (Array.isArray(c)) {
2386 if (c.length > 0) {
2387 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2388 // merge adjacent text nodes
2389 if (isTextNode(c[0]) && isTextNode(last)) {
2390 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2391 c.shift();
2392 }
2393 res.push.apply(res, c);
2394 }
2395 } else if (isPrimitive(c)) {
2396 if (isTextNode(last)) {
2397 // merge adjacent text nodes
2398 // this is necessary for SSR hydration because text nodes are
2399 // essentially merged when rendered to HTML strings
2400 res[lastIndex] = createTextVNode(last.text + c);
2401 } else if (c !== '') {
2402 // convert primitive to vnode
2403 res.push(createTextVNode(c));
2404 }
2405 } else {
2406 if (isTextNode(c) && isTextNode(last)) {
2407 // merge adjacent text nodes
2408 res[lastIndex] = createTextVNode(last.text + c.text);
2409 } else {
2410 // default key for nested array children (likely generated by v-for)
2411 if (isTrue(children._isVList) &&
2412 isDef(c.tag) &&
2413 isUndef(c.key) &&
2414 isDef(nestedIndex)) {
2415 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2416 }
2417 res.push(c);
2418 }
2419 }
2420 }
2421 return res
2422 }
2423
2424 /* */
2425

Callers 1

normalizeChildrenFunction · 0.85

Calls 7

isUndefFunction · 0.85
isTextNodeFunction · 0.85
createTextVNodeFunction · 0.85
isPrimitiveFunction · 0.85
isTrueFunction · 0.85
isDefFunction · 0.85
applyMethod · 0.45

Tested by

no test coverage detected