Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 30 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | import { ThemeField } from "./types"; |
||
2 | |||
3 | /** |
||
4 | * Utility function to add CSS in multiple passes. |
||
5 | * |
||
6 | * @param {string} styleString |
||
7 | */ |
||
8 | 1 | export const addStyle = (styleString: string) => { |
|
9 | 3 | const style = document.createElement("style"); |
|
10 | 3 | style.textContent = styleString; |
|
11 | 3 | document.head.append(style); |
|
12 | }; |
||
13 | |||
14 | /*istanbul ignore next */ |
||
15 | 1 | export const printDev = (output: any) => { |
|
16 | if (process.env.NODE_ENV === "development") { |
||
17 | console.log(output); |
||
18 | } |
||
19 | }; |
||
20 | |||
21 | 1 | export const parseThemeField = ( |
|
22 | themeField: Partial<ThemeField>, |
||
23 | defaultThemeField: ThemeField |
||
24 | ): ThemeField => { |
||
25 | 8 | return { |
|
26 | className: themeField.className, |
||
27 | style: themeField.style || defaultThemeField.style, |
||
28 | }; |
||
29 | }; |
||
30 |