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

Function resolveAsset

static/vuejs/vue.runtime.esm.js:1236–1262  ·  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

1234 * to assets defined in its ancestor chain.
1235 */
1236function 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

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