(componentName, config, configTypes)
| 145 | }; |
| 146 | |
| 147 | const 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 | |
| 163 | const isVisible = (element) => { |
| 164 | if (!element) { |
no test coverage detected