-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgeneralfunctions.ts
More file actions
37 lines (28 loc) · 874 Bytes
/
Copy pathgeneralfunctions.ts
File metadata and controls
37 lines (28 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* General Purpose Functions that can be reused across classes and tasks.
*/
export interface IGeneralFunctions {
sleep(ms: number): Promise<void>;
trimValues(values: string[]): string[];
trimValue(value: string): string;
}
export class GeneralFunctions implements IGeneralFunctions {
public sleep(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
}
public trimValues(values: string[]): string[] {
var returnValue: string[] = [];
if (values != null) {
values.forEach(value => {
returnValue.push(this.trimValue(value));
});
}
return returnValue;
}
public trimValue(value: string): string {
if (value !== null && value !== undefined) {
return value.trim();
}
return value;
}
}