File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,22 @@ import { isObject } from "lodash";
22import type { ThemeValues } from "./types" ;
33
44export function isTextStyleObject ( value : any ) : boolean {
5- return Object . keys ( value ) . some ( ( key ) =>
6- [
7- "fontFamily" ,
8- "fontWeight" ,
9- "fontSize" ,
10- "fontStyle" ,
11- "lineHeight" ,
12- "letterSpacing" ,
13- ] . includes ( key )
14- ) ;
5+ try {
6+ return Object . keys ( value ) . some ( ( key ) =>
7+ [
8+ "fontFamily" ,
9+ "fontWeight" ,
10+ "fontSize" ,
11+ "fontStyle" ,
12+ "lineHeight" ,
13+ "letterSpacing" ,
14+ ] . includes ( key )
15+ ) ;
16+ } catch ( e ) {
17+ // If `value` is not an object, the above code will throw an error
18+ // Catch error and return false is more efficient than a call to `isObject`
19+ return false ;
20+ }
1521}
1622
1723export function asThemeValuesObject ( value : any ) : ThemeValues | null {
You can’t perform that action at this time.
0 commit comments