@@ -7,7 +7,11 @@ var spaces = require('space-separated-tokens')
7
7
var commas = require ( 'comma-separated-tokens' )
8
8
var style = require ( 'style-to-object' )
9
9
var ns = require ( 'web-namespaces' )
10
- var is = require ( 'unist-util-is' )
10
+ var convert = require ( 'unist-util-is/convert' )
11
+
12
+ var root = convert ( 'root' )
13
+ var element = convert ( 'element' )
14
+ var text = convert ( 'text' )
11
15
12
16
var dashes = / - ( [ a - z ] ) / g
13
17
@@ -39,8 +43,8 @@ function wrapper(h, node, options) {
39
43
prefix = r === true || v === true || vd === true ? 'h-' : false
40
44
}
41
45
42
- if ( is ( ' root' , node ) ) {
43
- if ( node . children . length === 1 && is ( ' element' , node . children [ 0 ] ) ) {
46
+ if ( root ( node ) ) {
47
+ if ( node . children . length === 1 && element ( node . children [ 0 ] ) ) {
44
48
node = node . children [ 0 ]
45
49
} else {
46
50
node = {
@@ -50,7 +54,7 @@ function wrapper(h, node, options) {
50
54
children : node . children
51
55
}
52
56
}
53
- } else if ( ! is ( ' element' , node ) ) {
57
+ } else if ( ! element ( node ) ) {
54
58
throw new Error (
55
59
'Expected root or element, not `' + ( ( node && node . type ) || node ) + '`'
56
60
)
@@ -123,9 +127,9 @@ function toH(h, node, ctx) {
123
127
while ( ++ index < length ) {
124
128
value = children [ index ]
125
129
126
- if ( is ( ' element' , value ) ) {
130
+ if ( element ( value ) ) {
127
131
elements . push ( toH ( h , value , ctx ) )
128
- } else if ( is ( ' text' , value ) ) {
132
+ } else if ( text ( value ) ) {
129
133
elements . push ( value . value )
130
134
}
131
135
}
0 commit comments