File tree Expand file tree Collapse file tree 4 files changed +32
-26
lines changed Expand file tree Collapse file tree 4 files changed +32
-26
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,11 @@ import {isObject} from './utils';
14
14
export default ( Component : Object , defaultStyles : Object , options : Object ) => {
15
15
const WrappedComponent = class extends Component {
16
16
render ( ) {
17
- let propsChanged = false ,
17
+ let propsChanged ,
18
18
styles ;
19
19
20
+ propsChanged = false ;
21
+
20
22
if ( this . props . styles ) {
21
23
styles = this . props . styles ;
22
24
} else if ( isObject ( defaultStyles ) ) {
Original file line number Diff line number Diff line change @@ -15,18 +15,20 @@ export default (userConfiguration = {}) => {
15
15
errorWhenNotFound : true
16
16
} ;
17
17
18
- for ( const name in userConfiguration ) {
19
- const value = userConfiguration [ name ] ;
18
+ for ( const name in userConfiguration ) {
19
+ if ( userConfiguration . hasOwnProperty ( name ) ) {
20
+ const value = userConfiguration [ name ] ;
20
21
21
- if ( ! ( name in configuration ) ) {
22
- throw new Error ( 'Unknown configuration property "' + name + '".' ) ;
23
- }
22
+ if ( ! ( name in configuration ) ) {
23
+ throw new Error ( 'Unknown configuration property "' + name + '".' ) ;
24
+ }
24
25
25
- if ( value !== true && value !== false ) {
26
- throw new Error ( '"' + name + '" property value must be a boolean.' ) ;
27
- }
26
+ if ( value !== true && value !== false ) {
27
+ throw new Error ( '"' + name + '" property value must be a boolean.' ) ;
28
+ }
28
29
29
- configuration [ name ] = value ;
30
+ configuration [ name ] = value ;
31
+ }
30
32
}
31
33
32
34
return configuration ;
Original file line number Diff line number Diff line change 1
- const styleNameIndex = { } ;
2
1
import { trim , filterForTruthy } from './utils' ;
3
2
3
+ const styleNameIndex = { } ;
4
+
4
5
export default ( styleNamePropertyValue : string , allowMultiple : boolean ) : Array < string > => {
5
6
let styleNames ;
6
7
Original file line number Diff line number Diff line change 1
- export function isObject ( obj ) {
1
+ export const isObject = function ( obj ) {
2
2
return obj === Object ( obj ) ;
3
- }
3
+ } ;
4
4
5
- export function isFunction ( func ) {
5
+ export const isFunction = function ( func ) {
6
6
return (
7
- Object . prototype . toString . call ( func ) === '[object Function]'
8
- || Object . prototype . toString . call ( func ) === '[object GeneratorFunction]'
9
- ) ;
10
- }
7
+ Object . prototype . toString . call ( func ) === '[object Function]' ||
8
+ Object . prototype . toString . call ( func ) === '[object GeneratorFunction]'
9
+ ) ;
10
+ } ;
11
11
12
- export function isArray ( arr ) {
12
+ export const isArray = function ( arr ) {
13
13
return Array . isArray ? Array . isArray ( arr ) : Object . prototype . toString . call ( arr ) === '[object Array]' ;
14
- }
14
+ } ;
15
15
16
- export function trim ( str ) {
16
+ export const trim = function ( str ) {
17
17
return String . prototype . trim ? str . trim ( ) : str . replace ( / ^ [ \s \uFEFF \xA0 ] + | [ \s \uFEFF \xA0 ] + $ / g, '' ) ;
18
- }
18
+ } ;
19
19
20
- export function filterForTruthy ( arr ) {
20
+ export const filterForTruthy = function ( arr ) {
21
21
const results = [ ] ;
22
- for ( const key in arr ) {
23
- if ( arr [ key ] ) {
22
+
23
+ for ( const key in arr ) {
24
+ if ( arr [ key ] ) {
24
25
results . push ( arr [ key ] ) ;
25
26
}
26
27
}
27
28
28
29
return results ;
29
- }
30
+ } ;
You can’t perform that action at this time.
0 commit comments