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