* Ensure all props option syntax are normalized into the * Object-based format. * * @param {Object} options
(options)
| 1820 | */ |
| 1821 | |
| 1822 | function guardProps(options) { |
| 1823 | var props = options.props; |
| 1824 | var i, val; |
| 1825 | if (isArray(props)) { |
| 1826 | options.props = {}; |
| 1827 | i = props.length; |
| 1828 | while (i--) { |
| 1829 | val = props[i]; |
| 1830 | if (typeof val === 'string') { |
| 1831 | options.props[val] = null; |
| 1832 | } else if (val.name) { |
| 1833 | options.props[val.name] = val; |
| 1834 | } |
| 1835 | } |
| 1836 | } else if (isPlainObject(props)) { |
| 1837 | var keys = Object.keys(props); |
| 1838 | i = keys.length; |
| 1839 | while (i--) { |
| 1840 | val = props[keys[i]]; |
| 1841 | if (typeof val === 'function') { |
| 1842 | props[keys[i]] = { type: val }; |
| 1843 | } |
| 1844 | } |
| 1845 | } |
| 1846 | } |
| 1847 | |
| 1848 | /** |
| 1849 | * Guard an Array-format assets option and converted it |
no test coverage detected