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

Function normalizeProps

static/vuejs/vue.esm.js:1146–1172  ·  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

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