File tree 1 file changed +5
-15
lines changed
1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -45,30 +45,20 @@ let unitlessKeys = {
45
45
strokeDashoffset : 1 ,
46
46
strokeMiterlimit : 1 ,
47
47
strokeOpacity : 1 ,
48
- strokeWidth : 1
48
+ strokeWidth : 1 ,
49
49
} ;
50
50
51
51
// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
52
- export const unitize = ( name , value , { cache } ) => {
53
- let cachedName = cache [ name ] ;
54
- if ( ! cachedName ) {
55
- cachedName = cache [ name ] = { } ;
56
- }
57
-
58
- const cachedValue = cachedName [ value ] ;
59
- if ( cachedValue ) {
60
- return cachedValue ;
61
- }
62
-
52
+ export const unitize = ( name , value ) => {
63
53
if ( value == null || typeof value === "boolean" || value === "" ) {
64
- return ( cachedName [ value ] = "" ) ;
54
+ return "" ;
65
55
}
66
56
67
57
if ( typeof value === "number" && value !== 0 && ! unitlessKeys [ name ] ) {
68
- return ( cachedName [ value ] = value + "px" ) ; // Presumes implicit 'px' suffix for unitless numbers
58
+ return value + "px" ; // Presumes implicit 'px' suffix for unitless numbers
69
59
}
70
60
71
- return ( cachedName [ value ] = String ( value ) . trim ( ) ) ;
61
+ return String ( value ) . trim ( ) ;
72
62
} ;
73
63
74
64
export default unitize ;
You can’t perform that action at this time.
0 commit comments