MCPcopy
hub / github.com/keepfool/vue-tutorials / guardComponents

Function guardComponents

06.Router/basic/js/vue.js:1788–1813  ·  view source on GitHub ↗

* Make sure component options get converted to actual * constructors. * * @param {Object} options

(options)

Source from the content-addressed store, hash-verified

1786 */
1787
1788 function guardComponents(options) {
1789 if (options.components) {
1790 var components = options.components = guardArrayAssets(options.components);
1791 var ids = Object.keys(components);
1792 var def;
1793 if ('development' !== 'production') {
1794 var map = options._componentNameMap = {};
1795 }
1796 for (var i = 0, l = ids.length; i < l; i++) {
1797 var key = ids[i];
1798 if (commonTagRE.test(key) || reservedTagRE.test(key)) {
1799 'development' !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);
1800 continue;
1801 }
1802 // record a all lowercase <-> kebab-case mapping for
1803 // possible custom element case error warning
1804 if ('development' !== 'production') {
1805 map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);
1806 }
1807 def = components[key];
1808 if (isPlainObject(def)) {
1809 components[key] = Vue.extend(def);
1810 }
1811 }
1812 }
1813 }
1814
1815 /**
1816 * Ensure all props option syntax are normalized into the

Callers 1

mergeOptionsFunction · 0.70

Calls 4

guardArrayAssetsFunction · 0.70
warnFunction · 0.70
hyphenateFunction · 0.70
isPlainObjectFunction · 0.70

Tested by

no test coverage detected