Skip to content

Commit 2167985

Browse files
committed
[+] Merged #80
1 parent 9818b8c commit 2167985

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/constructors/styled.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import css from './css'
22
import domElements from '../utils/domElements'
3-
4-
// check valid vue-styled-component element type
5-
function isValidElementType (tag) {
6-
if (typeof tag === 'undefined' || typeof tag === 'number') {
7-
return false
8-
}
9-
if (typeof tag === 'string') {
10-
return domElements.includes(tag)
11-
}
12-
if (typeof tag === 'object') {
13-
return !!tag.template || !!tag.withComponent
14-
}
15-
return true
16-
}
3+
import isValidElementType from '../utils/isValidElementType'
174

185
export default (createStyledComponent) => {
196
const styled = (tagName, props = {}) => {

src/utils/isValidElementType.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import domElements from './domElements'
2+
3+
export default function isValidElementType (tag) {
4+
if (typeof tag === 'undefined' || typeof tag === 'number') {
5+
return false
6+
}
7+
if (typeof tag === 'string') {
8+
return domElements.includes(tag)
9+
}
10+
if (typeof tag === 'object') {
11+
return !!tag.template || !!tag.withComponent
12+
}
13+
return true
14+
}

0 commit comments

Comments
 (0)