MCPcopy
hub / github.com/NaiboWang/EasySpider / normalizeInject

Function normalizeInject

ElectronJS/src/taskGrid/vue.js:1468–1490  ·  view source on GitHub ↗

* Normalize all injections into Object-based format

(options, vm)

Source from the content-addressed store, hash-verified

1466 * Normalize all injections into Object-based format
1467 */
1468 function normalizeInject (options, vm) {
1469 var inject = options.inject;
1470 if (!inject) { return }
1471 var normalized = options.inject = {};
1472 if (Array.isArray(inject)) {
1473 for (var i = 0; i < inject.length; i++) {
1474 normalized[inject[i]] = { from: inject[i] };
1475 }
1476 } else if (isPlainObject(inject)) {
1477 for (var key in inject) {
1478 var val = inject[key];
1479 normalized[key] = isPlainObject(val)
1480 ? extend({ from: key }, val)
1481 : { from: val };
1482 }
1483 } else {
1484 warn(
1485 "Invalid value for option \"inject\": expected an Array or an Object, " +
1486 "but got " + (toRawType(inject)) + ".",
1487 vm
1488 );
1489 }
1490 }
1491
1492 /**
1493 * Normalize raw function directives into object format.

Callers 1

mergeOptionsFunction · 0.70

Calls 4

extendFunction · 0.85
isPlainObjectFunction · 0.70
warnFunction · 0.70
toRawTypeFunction · 0.70

Tested by

no test coverage detected