MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / guardProps

Function guardProps

06.Router/basic/js/vue.js:1822–1846  ·  view source on GitHub ↗

* Ensure all props option syntax are normalized into the * Object-based format. * * @param {Object} options

(options)

Source from the content-addressed store, hash-verified

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

Callers 1

mergeOptionsFunction · 0.70

Calls 2

isArrayFunction · 0.85
isPlainObjectFunction · 0.70

Tested by

no test coverage detected