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

Function normalizeProps

static/vuejs/vue.js:1152–1178  ·  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

1150 * Object-based format.
1151 */
1152function normalizeProps (options) {
1153 var props = options.props;
1154 if (!props) { return }
1155 var res = {};
1156 var i, val, name;
1157 if (Array.isArray(props)) {
1158 i = props.length;
1159 while (i--) {
1160 val = props[i];
1161 if (typeof val === 'string') {
1162 name = camelize(val);
1163 res[name] = { type: null };
1164 } else {
1165 warn('props must be strings when using array syntax.');
1166 }
1167 }
1168 } else if (isPlainObject(props)) {
1169 for (var key in props) {
1170 val = props[key];
1171 name = camelize(key);
1172 res[name] = isPlainObject(val)
1173 ? val
1174 : { type: val };
1175 }
1176 }
1177 options.props = res;
1178}
1179
1180/**
1181 * 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