MCPcopy Create free account
hub / github.com/TruthHun/BookStack / resolveAsset

Function resolveAsset

static/vuejs/vue.js:1246–1272  ·  view source on GitHub ↗

* Resolve an asset. * This function is used because child instances need access * to assets defined in its ancestor chain.

(
  options,
  type,
  id,
  warnMissing
)

Source from the content-addressed store, hash-verified

1244 * to assets defined in its ancestor chain.
1245 */
1246function resolveAsset (
1247 options,
1248 type,
1249 id,
1250 warnMissing
1251) {
1252 /* istanbul ignore if */
1253 if (typeof id !== 'string') {
1254 return
1255 }
1256 var assets = options[type];
1257 // check local registration variations first
1258 if (hasOwn(assets, id)) { return assets[id] }
1259 var camelizedId = camelize(id);
1260 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1261 var PascalCaseId = capitalize(camelizedId);
1262 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1263 // fallback to prototype chain
1264 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1265 if ("development" !== 'production' && warnMissing && !res) {
1266 warn(
1267 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1268 options
1269 );
1270 }
1271 return res
1272}
1273
1274/* */
1275

Callers 3

_createElementFunction · 0.70
resolveFilterFunction · 0.70
normalizeDirectives$1Function · 0.70

Calls 2

hasOwnFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected