* Ensure all props option syntax are normalized into the * Object-based format.
(options)
| 1150 | * Object-based format. |
| 1151 | */ |
| 1152 | function 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. |
no test coverage detected