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

Function resolveAsset

static/vuejs/vue.runtime.js:1242–1268  ·  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

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

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