* Merge two option objects into a new one. * Core utility used in both instantiation and inheritance.
( parent, child, vm )
| 1189 | * Core utility used in both instantiation and inheritance. |
| 1190 | */ |
| 1191 | function mergeOptions ( |
| 1192 | parent, |
| 1193 | child, |
| 1194 | vm |
| 1195 | ) { |
| 1196 | if (process.env.NODE_ENV !== 'production') { |
| 1197 | checkComponents(child); |
| 1198 | } |
| 1199 | normalizeProps(child); |
| 1200 | normalizeDirectives(child); |
| 1201 | var extendsFrom = child.extends; |
| 1202 | if (extendsFrom) { |
| 1203 | parent = typeof extendsFrom === 'function' |
| 1204 | ? mergeOptions(parent, extendsFrom.options, vm) |
| 1205 | : mergeOptions(parent, extendsFrom, vm); |
| 1206 | } |
| 1207 | if (child.mixins) { |
| 1208 | for (var i = 0, l = child.mixins.length; i < l; i++) { |
| 1209 | var mixin = child.mixins[i]; |
| 1210 | if (mixin.prototype instanceof Vue$2) { |
| 1211 | mixin = mixin.options; |
| 1212 | } |
| 1213 | parent = mergeOptions(parent, mixin, vm); |
| 1214 | } |
| 1215 | } |
| 1216 | var options = {}; |
| 1217 | var key; |
| 1218 | for (key in parent) { |
| 1219 | mergeField(key); |
| 1220 | } |
| 1221 | for (key in child) { |
| 1222 | if (!hasOwn(parent, key)) { |
| 1223 | mergeField(key); |
| 1224 | } |
| 1225 | } |
| 1226 | function mergeField (key) { |
| 1227 | var strat = strats[key] || defaultStrat; |
| 1228 | options[key] = strat(parent[key], child[key], vm, key); |
| 1229 | } |
| 1230 | return options |
| 1231 | } |
| 1232 | |
| 1233 | /** |
| 1234 | * Resolve an asset. |
no test coverage detected