* Resolve an asset. * This function is used because child instances need access * to assets defined in its ancestor chain.
( options, type, id, warnMissing )
| 1234 | * to assets defined in its ancestor chain. |
| 1235 | */ |
| 1236 | function resolveAsset ( |
| 1237 | options, |
| 1238 | type, |
| 1239 | id, |
| 1240 | warnMissing |
| 1241 | ) { |
| 1242 | /* istanbul ignore if */ |
| 1243 | if (typeof id !== 'string') { |
| 1244 | return |
| 1245 | } |
| 1246 | var assets = options[type]; |
| 1247 | // check local registration variations first |
| 1248 | if (hasOwn(assets, id)) { return assets[id] } |
| 1249 | var camelizedId = camelize(id); |
| 1250 | if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } |
| 1251 | var PascalCaseId = capitalize(camelizedId); |
| 1252 | if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } |
| 1253 | // fallback to prototype chain |
| 1254 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; |
| 1255 | if (process.env.NODE_ENV !== 'production' && warnMissing && !res) { |
| 1256 | warn( |
| 1257 | 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, |
| 1258 | options |
| 1259 | ); |
| 1260 | } |
| 1261 | return res |
| 1262 | } |
| 1263 | |
| 1264 | /* */ |
| 1265 |
no test coverage detected