@@ -3,18 +3,26 @@ const currencyFormatter = new Intl.NumberFormat("ru-KZ", {
3
3
currency : "KZT" ,
4
4
} ) ;
5
5
6
- export const getPension = ( nettoSalary , minSalary ) =>
6
+ export const getPension = ( nettoSalary : number , minSalary : number ) =>
7
7
nettoSalary * 0.1 < minSalary * 75 ? nettoSalary * 0.1 : minSalary * 75 ;
8
8
9
- export const getTax = ( nettoSalary , minSalary , pension ) =>
9
+ export const getTax = (
10
+ nettoSalary : number ,
11
+ minSalary : number ,
12
+ pension : number ,
13
+ ) =>
10
14
nettoSalary === minSalary ? 0 : ( nettoSalary - pension - minSalary ) * 0.1 ;
11
15
12
- export const getGrossSalary = ( nettoSalary , pension , tax ) =>
13
- nettoSalary - pension - tax ;
16
+ export const getGrossSalary = (
17
+ nettoSalary : number ,
18
+ pension : number ,
19
+ tax : number ,
20
+ ) => nettoSalary - pension - tax ;
14
21
15
- export const getInsurance = ( salary ) => salary * 0.01 ;
22
+ export const getInsurance = ( salary : number ) => salary * 0.01 ;
16
23
17
- export const getSalaryInfo = ( salary ) => {
24
+ // TODO: fix calculation and cover with tests
25
+ export const getSalaryInfo = ( salary : number ) => {
18
26
const minSalary = 70000 ;
19
27
if ( salary <= minSalary ) {
20
28
return { nettoSalary : salary , pension : 0 , tax : 0 , grossSalary : salary } ;
@@ -29,4 +37,4 @@ export const getSalaryInfo = (salary) => {
29
37
return { nettoSalary, pension, tax, grossSalary, insurance } ;
30
38
} ;
31
39
32
- export const formatCurrency = ( number ) => currencyFormatter . format ( number ) ;
40
+ export const formatCurrency = ( num : number ) => currencyFormatter . format ( num ) ;
0 commit comments