@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
7
7
var _slicedToArray = function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; } } ; } ( ) ;
8
8
9
- var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
10
-
11
9
var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
12
10
13
11
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
@@ -44,79 +42,103 @@ var StyleValidator = function () {
44
42
var _this = this ;
45
43
46
44
var _loop = function _loop ( propNameCamelCase ) {
47
- // eslint-disable-line guard-for-in
48
45
var propName = propNameCamelCase . replace ( capsRe , function ( match ) {
49
- return '-' + match [ 0 ] . toLowerCase ( ) ;
46
+ return `- ${ match [ 0 ] . toLowerCase ( ) } ` ;
50
47
} ) ;
51
48
52
49
var supportInfo = _supportMatrix2 . default [ propName ] ;
53
50
54
51
if ( ! supportInfo ) {
55
52
if ( _this . config . strict ) {
56
53
return {
57
- v : new Error ( ' Unknown style property `' + propName + ' ` supplied to `' + componentName + '`.' )
54
+ v : new Error ( ` Unknown style property \` ${ propName } \ ` supplied to \` ${ componentName } \`.` )
58
55
} ;
59
56
}
60
- return {
61
- v : undefined
62
- } ;
63
- }
64
-
65
- var unsupported = [ ] ;
66
- var messages = new Map ( ) ;
67
- _this . config . platforms . forEach ( function ( platform ) {
68
- if ( typeof supportInfo [ platform ] === 'string' ) {
69
- var msg = supportInfo [ platform ] ;
70
- if ( ! messages . has ( msg ) ) {
71
- messages . set ( msg , [ ] ) ;
57
+ } else {
58
+ var unsupported = [ ] ;
59
+ var messages = new Map ( ) ;
60
+ _this . config . platforms . forEach ( function ( platform ) {
61
+ if ( typeof supportInfo [ platform ] === 'string' ) {
62
+ var msg = supportInfo [ platform ] ;
63
+ if ( ! messages . has ( msg ) ) {
64
+ messages . set ( msg , [ ] ) ;
65
+ }
66
+ messages . get ( msg ) . push ( platform ) ;
67
+ } else if ( supportInfo [ platform ] === false ) {
68
+ unsupported . push ( platform ) ;
72
69
}
73
- messages . get ( msg ) . push ( platform ) ;
74
- } else if ( supportInfo [ platform ] === false ) {
75
- unsupported . push ( platform ) ;
76
- }
77
- } ) ;
70
+ } ) ;
78
71
79
- if ( _this . config . warn ) {
80
- var _iteratorNormalCompletion = true ;
81
- var _didIteratorError = false ;
82
- var _iteratorError = undefined ;
72
+ if ( _this . config . warn ) {
73
+ // eslint-disable-next-line no-restricted-syntax
74
+ var _iteratorNormalCompletion2 = true ;
75
+ var _didIteratorError2 = false ;
76
+ var _iteratorError2 = undefined ;
83
77
84
- try {
85
- for ( var _iterator = messages [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
86
- var _step$value = _slicedToArray ( _step . value , 2 ) ,
87
- msg = _step$value [ 0 ] ,
88
- platforms = _step$value [ 1 ] ;
89
-
90
- console . warn ( 'Warning: Style property `' + propName + '` supplied to `' + componentName + '`, in ' + platforms . join ( ', ' ) + ': ' + msg . toLowerCase ( ) ) ; // eslint-disable-line no-console
91
- }
92
- } catch ( err ) {
93
- _didIteratorError = true ;
94
- _iteratorError = err ;
95
- } finally {
96
78
try {
97
- if ( ! _iteratorNormalCompletion && _iterator . return ) {
98
- _iterator . return ( ) ;
79
+ for ( var _iterator2 = messages [ Symbol . iterator ] ( ) , _step2 ; ! ( _iteratorNormalCompletion2 = ( _step2 = _iterator2 . next ( ) ) . done ) ; _iteratorNormalCompletion2 = true ) {
80
+ var _ref = _step2 . value ;
81
+
82
+ var _ref2 = _slicedToArray ( _ref , 2 ) ;
83
+
84
+ var msg = _ref2 [ 0 ] ;
85
+ var platforms = _ref2 [ 1 ] ;
86
+
87
+ console . warn ( `Warning: Style property \`${ propName } \` supplied to \`${ componentName } \`, in ${ platforms . join ( ', ' ) } : ${ msg . toLowerCase ( ) } ` ) ; // eslint-disable-line no-console
99
88
}
89
+ } catch ( err ) {
90
+ _didIteratorError2 = true ;
91
+ _iteratorError2 = err ;
100
92
} finally {
101
- if ( _didIteratorError ) {
102
- throw _iteratorError ;
93
+ try {
94
+ if ( ! _iteratorNormalCompletion2 && _iterator2 . return ) {
95
+ _iterator2 . return ( ) ;
96
+ }
97
+ } finally {
98
+ if ( _didIteratorError2 ) {
99
+ throw _iteratorError2 ;
100
+ }
103
101
}
104
102
}
105
103
}
106
- }
107
104
108
- if ( unsupported . length && _this . config . strict ) {
109
- return {
110
- v : new Error ( 'Style property `' + propName + '` supplied to `' + componentName + '` unsupported in: ' + unsupported . join ( ', ' ) + '.' )
111
- } ;
105
+ if ( unsupported . length && _this . config . strict ) {
106
+ return {
107
+ v : new Error ( `Style property \`${ propName } \` supplied to \`${ componentName } \` unsupported in: ${ unsupported . join ( ', ' ) } .` )
108
+ } ;
109
+ }
112
110
}
113
111
} ;
114
112
115
- for ( var propNameCamelCase in style ) {
116
- var _ret = _loop ( propNameCamelCase ) ;
113
+ // eslint-disable-next-line no-restricted-syntax
114
+ var _iteratorNormalCompletion = true ;
115
+ var _didIteratorError = false ;
116
+ var _iteratorError = undefined ;
117
+
118
+ try {
119
+ for ( var _iterator = Object . keys ( style ) [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
120
+ var propNameCamelCase = _step . value ;
121
+
122
+ var _ret = _loop ( propNameCamelCase ) ;
117
123
118
- if ( ( typeof _ret === 'undefined' ? 'undefined' : _typeof ( _ret ) ) === "object" ) return _ret . v ;
124
+ if ( typeof _ret === "object" ) return _ret . v ;
125
+ }
126
+ } catch ( err ) {
127
+ _didIteratorError = true ;
128
+ _iteratorError = err ;
129
+ } finally {
130
+ try {
131
+ if ( ! _iteratorNormalCompletion && _iterator . return ) {
132
+ _iterator . return ( ) ;
133
+ }
134
+ } finally {
135
+ if ( _didIteratorError ) {
136
+ throw _iteratorError ;
137
+ }
138
+ }
119
139
}
140
+
141
+ return undefined ;
120
142
}
121
143
} ] ) ;
122
144
0 commit comments