@@ -39,16 +39,16 @@ function createCustomEvent (name, args) {
39
39
const isBoolean = val => / f u n c t i o n B o o l e a n / . test ( String ( val ) ) ;
40
40
const isNumber = val => / f u n c t i o n N u m b e r / . test ( String ( val ) ) ;
41
41
42
- function convertAttributeValue ( value , name , options ) {
43
- if ( isBoolean ( options . type ) ) {
42
+ function convertAttributeValue ( value , name , { type } = { } ) {
43
+ if ( isBoolean ( type ) ) {
44
44
if ( value === 'true' || value === 'false' ) {
45
45
return value === 'true'
46
46
}
47
47
if ( value === '' || value === name ) {
48
48
return true
49
49
}
50
50
return value != null
51
- } else if ( isNumber ( options . type ) ) {
51
+ } else if ( isNumber ( type ) ) {
52
52
const parsed = parseFloat ( value , 10 ) ;
53
53
return isNaN ( parsed ) ? value : parsed
54
54
} else {
@@ -58,7 +58,7 @@ function convertAttributeValue (value, name, options) {
58
58
59
59
function toVNodes ( h , children ) {
60
60
const res = [ ] ;
61
- for ( let i = 0 ; i < children . length ; i ++ ) {
61
+ for ( let i = 0 , l = children . length ; i < l ; i ++ ) {
62
62
res . push ( toVNode ( h , children [ i ] ) ) ;
63
63
}
64
64
return res
@@ -86,7 +86,7 @@ function toVNode (h, node) {
86
86
87
87
function getAttributes ( node ) {
88
88
const res = { } ;
89
- for ( let i = 0 ; i < node . attributes . length ; i ++ ) {
89
+ for ( let i = 0 , l = node . attributes . length ; i < l ; i ++ ) {
90
90
const attr = node . attributes [ i ] ;
91
91
res [ attr . nodeName ] = attr . nodeValue ;
92
92
}
0 commit comments