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

Function normalizeProps

ElectronJS/src/taskGrid/vue.js:1431–1463  ·  view source on GitHub ↗

* Ensure all props option syntax are normalized into the * Object-based format.

(options, vm)

Source from the content-addressed store, hash-verified

1429 * Object-based format.
1430 */
1431 function normalizeProps (options, vm) {
1432 var props = options.props;
1433 if (!props) { return }
1434 var res = {};
1435 var i, val, name;
1436 if (Array.isArray(props)) {
1437 i = props.length;
1438 while (i--) {
1439 val = props[i];
1440 if (typeof val === 'string') {
1441 name = camelize(val);
1442 res[name] = { type: null };
1443 } else {
1444 warn('props must be strings when using array syntax.');
1445 }
1446 }
1447 } else if (isPlainObject(props)) {
1448 for (var key in props) {
1449 val = props[key];
1450 name = camelize(key);
1451 res[name] = isPlainObject(val)
1452 ? val
1453 : { type: val };
1454 }
1455 } else {
1456 warn(
1457 "Invalid value for option \"props\": expected an Array or an Object, " +
1458 "but got " + (toRawType(props)) + ".",
1459 vm
1460 );
1461 }
1462 options.props = res;
1463 }
1464
1465 /**
1466 * Normalize all injections into Object-based format

Callers 1

mergeOptionsFunction · 0.70

Calls 3

warnFunction · 0.70
isPlainObjectFunction · 0.70
toRawTypeFunction · 0.70

Tested by

no test coverage detected