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

Function resolveAsset

static/vuejs/vue.runtime.common.js:1238–1264  ·  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

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

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