MCPcopy
hub / github.com/mdbootstrap/TW-Elements / typeCheckConfig

Function typeCheckConfig

src/js/util/index.js:147–161  ·  view source on GitHub ↗
(componentName, config, configTypes)

Source from the content-addressed store, hash-verified

145};
146
147const typeCheckConfig = (componentName, config, configTypes) => {
148 Object.keys(configTypes).forEach((property) => {
149 const expectedTypes = configTypes[property];
150 const value = config[property];
151 const valueType = value && isElement(value) ? "element" : toType(value);
152
153 if (!new RegExp(expectedTypes).test(valueType)) {
154 throw new Error(
155 `${componentName.toUpperCase()}: ` +
156 `Option "${property}" provided type "${valueType}" ` +
157 `but expected type "${expectedTypes}".`
158 );
159 }
160 });
161};
162
163const isVisible = (element) => {
164 if (!element) {

Callers 15

_getConfigMethod · 0.90
_getClassesMethod · 0.90
_getConfigMethod · 0.90
_getConfigMethod · 0.90
_getConfigMethod · 0.90
_getConfigMethod · 0.90
_getClassesMethod · 0.90
_getConfigMethod · 0.90
_getClassesMethod · 0.90
_getConfigMethod · 0.90
_getClassesMethod · 0.90
_getConfigMethod · 0.90

Calls 2

isElementFunction · 0.85
toTypeFunction · 0.85

Tested by

no test coverage detected