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

Function normalizeProps

static/vuejs/vue.runtime.js:1148–1174  ·  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

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