* Merge two option objects into a new one. * Core utility used in both instantiation and inheritance.
(parent, child, vm)
| 1412 | * Core utility used in both instantiation and inheritance. |
| 1413 | */ |
| 1414 | function mergeOptions(parent, child, vm) { |
| 1415 | { |
| 1416 | checkComponents(child); |
| 1417 | } |
| 1418 | |
| 1419 | if (typeof child === "function") { |
| 1420 | child = child.options; |
| 1421 | } |
| 1422 | |
| 1423 | normalizeProps(child, vm); |
| 1424 | normalizeInject(child, vm); |
| 1425 | normalizeDirectives(child); |
| 1426 | var extendsFrom = child.extends; |
| 1427 | if (extendsFrom) { |
| 1428 | parent = mergeOptions(parent, extendsFrom, vm); |
| 1429 | } |
| 1430 | if (child.mixins) { |
| 1431 | for (var i = 0, l = child.mixins.length; i < l; i++) { |
| 1432 | parent = mergeOptions(parent, child.mixins[i], vm); |
| 1433 | } |
| 1434 | } |
| 1435 | var options = {}; |
| 1436 | var key; |
| 1437 | for (key in parent) { |
| 1438 | mergeField(key); |
| 1439 | } |
| 1440 | for (key in child) { |
| 1441 | if (!hasOwn(parent, key)) { |
| 1442 | mergeField(key); |
| 1443 | } |
| 1444 | } |
| 1445 | function mergeField(key) { |
| 1446 | var strat = strats[key] || defaultStrat; |
| 1447 | options[key] = strat(parent[key], child[key], vm, key); |
| 1448 | } |
| 1449 | return options; |
| 1450 | } |
| 1451 | |
| 1452 | /** |
| 1453 | * Resolve an asset. |
no test coverage detected