MCPcopy
hub / github.com/fanmingming/live / normalizeProps

Function normalizeProps

m3u8/vue.js:1430–1462  ·  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

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

Callers 1

mergeOptionsFunction · 0.85

Calls 3

warnFunction · 0.85
isPlainObjectFunction · 0.85
toRawTypeFunction · 0.85

Tested by

no test coverage detected