Total Complexity | 2 |
Complexity/F | 0 |
Lines of Code | 29 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | // Convert time to hours and minutes |
||
2 | export const calcTime = (time: number): string => { |
||
3 | const hours = (time / 60) | 0 |
||
4 | const mins = time % 60 |
||
5 | return `${hours}h ${mins}m` |
||
6 | } |
||
7 | |||
8 | // Convert a number to money formatting |
||
9 | export const convertMoney = (money: number | bigint): string => { |
||
10 | const formatter = new Intl.NumberFormat('en-US', { |
||
11 | style: 'currency', |
||
12 | currency: 'USD', |
||
13 | minimumFractionDigits: 0, |
||
14 | }) |
||
15 | return formatter.format(money) |
||
16 | } |
||
17 | |||
18 | export const isPersistedState = (stateName: string) => { |
||
19 | try { |
||
20 | const sessionState = sessionStorage.getItem(stateName) |
||
21 | if (sessionState !== null) { |
||
22 | return JSON.parse(sessionState) |
||
23 | } |
||
24 | return null |
||
25 | } catch (error) { |
||
26 | console.error(error) |
||
27 | } |
||
28 | } |
||
29 |