Skip to content

Commit 02ad77f

Browse files
Fix lint errors
1 parent 8cdef9c commit 02ad77f

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/utils/basicHelper.ts

+33-33
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,75 @@ const today: Date = new Date();
55
* @description Basic helper used to wrap basic methods don't used on pages
66
*/
77
export default {
8-
/**
8+
/**
99
* Sort array of strings
1010
* @param arrayToSort {string[]} Array to sort
1111
* @return {Promise<string[]}
1212
*/
13-
async sortArray(arrayToSort: string[]): Promise<string[]> {
14-
return arrayToSort.sort((a: string, b: string): number => a.localeCompare(b));
15-
},
13+
async sortArray(arrayToSort: string[]): Promise<string[]> {
14+
return arrayToSort.sort((a: string, b: string): number => a.localeCompare(b));
15+
},
1616

17-
/**
17+
/**
1818
* Sort array of numbers
1919
* @param arrayToSort {number[]} Array to sort
2020
* @return {Promise<number[]}
2121
*/
22-
async sortArrayNumber(arrayToSort: number[]): Promise<number[]> {
23-
return arrayToSort.sort((a: number, b: number): number => a - b);
24-
},
22+
async sortArrayNumber(arrayToSort: number[]): Promise<number[]> {
23+
return arrayToSort.sort((a: number, b: number): number => a - b);
24+
},
2525

26-
/**
26+
/**
2727
* Sort array of dates
2828
* @param arrayToSort {string[]} Array to sort
2929
* @return {Promise<string[]}
3030
*/
31-
async sortArrayDate(arrayToSort: string[]): Promise<string[]> {
32-
return arrayToSort.sort((a: string, b: string): number => new Date(a).getTime() - new Date(b).getTime());
33-
},
31+
async sortArrayDate(arrayToSort: string[]): Promise<string[]> {
32+
return arrayToSort.sort((a: string, b: string): number => new Date(a).getTime() - new Date(b).getTime());
33+
},
3434

35-
/**
35+
/**
3636
* Calculate percentage
3737
* @param num {number|float} Number to do the percentage
3838
* @param percentage {number} Percentage value
3939
* @returns {Promise<number|float>}
4040
*/
41-
async percentage(num: number, percentage: number): Promise<number> {
42-
return (num / 100) * percentage;
43-
},
41+
async percentage(num: number, percentage: number): Promise<number> {
42+
return (num / 100) * percentage;
43+
},
4444

45-
/**
45+
/**
4646
* Calculate age
4747
* @param birthdate {string} Date of birth
4848
* @returns {Promise<number>}
4949
*/
50-
async age(birthdate: Date): Promise<number> {
51-
const age = today.getFullYear() - birthdate.getFullYear();
50+
async age(birthdate: Date): Promise<number> {
51+
const age = today.getFullYear() - birthdate.getFullYear();
5252

53-
if (today.getMonth() < birthdate.getMonth()
53+
if (today.getMonth() < birthdate.getMonth()
5454
|| (today.getMonth() === birthdate.getMonth() && today.getDate() < birthdate.getDate())) {
55-
return age - 1;
56-
}
55+
return age - 1;
56+
}
5757

58-
return age;
59-
},
58+
return age;
59+
},
6060

61-
/**
61+
/**
6262
* Make a string's first character uppercase
6363
* @param value {string}
6464
* @returns {string}
6565
*/
66-
capitalize(value: string): string {
67-
return value.charAt(0).toUpperCase() + value.slice(1);
68-
},
66+
capitalize(value: string): string {
67+
return value.charAt(0).toUpperCase() + value.slice(1);
68+
},
6969

70-
/**
70+
/**
7171
* Search occurrence of a value in text
7272
* @param text {string}
7373
* @param searchedValue {string}
7474
* @returns {string}
7575
*/
76-
async searchOccurrence(text: string, searchedValue: string): Promise<number> {
77-
return text.split(searchedValue).length - 1;
78-
},
79-
};
76+
async searchOccurrence(text: string, searchedValue: string): Promise<number> {
77+
return text.split(searchedValue).length - 1;
78+
},
79+
};

0 commit comments

Comments
 (0)