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

Function normalizeProps

static/vuejs/vue.runtime.common.js:1144–1170  ·  view source on GitHub ↗

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

(options)

Source from the content-addressed store, hash-verified

1142 * Object-based format.
1143 */
1144function normalizeProps (options) {
1145 var props = options.props;
1146 if (!props) { return }
1147 var res = {};
1148 var i, val, name;
1149 if (Array.isArray(props)) {
1150 i = props.length;
1151 while (i--) {
1152 val = props[i];
1153 if (typeof val === 'string') {
1154 name = camelize(val);
1155 res[name] = { type: null };
1156 } else if (process.env.NODE_ENV !== 'production') {
1157 warn('props must be strings when using array syntax.');
1158 }
1159 }
1160 } else if (isPlainObject(props)) {
1161 for (var key in props) {
1162 val = props[key];
1163 name = camelize(key);
1164 res[name] = isPlainObject(val)
1165 ? val
1166 : { type: val };
1167 }
1168 }
1169 options.props = res;
1170}
1171
1172/**
1173 * Normalize raw function directives into object format.

Callers 1

mergeOptionsFunction · 0.70

Calls 2

isPlainObjectFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected