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

Function resolveAsset

static/vuejs/vue.esm.js:1240–1266  ·  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

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

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