MCPcopy Create free account
hub / github.com/dashnowords/imfe / getNormalizationType

Function getNormalizationType

chapter17/vue.js:11353–11374  ·  view source on GitHub ↗
(
    children,
    maybeComponent
  )

Source from the content-addressed store, hash-verified

11351 // 1: simple normalization needed (possible 1-level deep nested array)
11352 // 2: full normalization needed
11353 function getNormalizationType (
11354 children,
11355 maybeComponent
11356 ) {
11357 var res = 0;
11358 for (var i = 0; i < children.length; i++) {
11359 var el = children[i];
11360 if (el.type !== 1) {
11361 continue
11362 }
11363 if (needsNormalization(el) ||
11364 (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
11365 res = 2;
11366 break
11367 }
11368 if (maybeComponent(el) ||
11369 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
11370 res = 1;
11371 }
11372 }
11373 return res
11374 }
11375
11376 function needsNormalization (el) {
11377 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'

Callers 1

genChildrenFunction · 0.85

Calls 1

needsNormalizationFunction · 0.85

Tested by

no test coverage detected