repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: remove unneeded premise in condition
[e-mobility-charging-stations-simulator.git]
/
src
/
utils
/
Utils.ts
diff --git
a/src/utils/Utils.ts
b/src/utils/Utils.ts
index f701cea041ab831d1b1ff323123e02c60b69b11b..4306d8872e0114928481769feb6bb6daf5ff603e 100644
(file)
--- a/
src/utils/Utils.ts
+++ b/
src/utils/Utils.ts
@@
-191,7
+191,7
@@
export class Utils {
}
public static isCFEnvironment(): boolean {
}
public static isCFEnvironment(): boolean {
- return
process.env.VCAP_APPLICATION !== undefined
;
+ return
!Utils.isNullOrUndefined(process.env.VCAP_APPLICATION)
;
}
public static isIterable<T>(obj: T): boolean {
}
public static isIterable<T>(obj: T): boolean {
@@
-223,17
+223,11
@@
export class Utils {
}
public static isEmptyArray(object: unknown | unknown[]): boolean {
}
public static isEmptyArray(object: unknown | unknown[]): boolean {
- if (Array.isArray(object) && object.length === 0) {
- return true;
- }
- return false;
+ return Array.isArray(object) && object.length === 0;
}
public static isNotEmptyArray(object: unknown | unknown[]): boolean {
}
public static isNotEmptyArray(object: unknown | unknown[]): boolean {
- if (Array.isArray(object) && object.length > 0) {
- return true;
- }
- return false;
+ return Array.isArray(object) && object.length > 0;
}
public static isEmptyObject(obj: object): boolean {
}
public static isEmptyObject(obj: object): boolean {
@@
-255,9
+249,9
@@
export class Utils {
* @param retryNumber - the number of retries that have already been attempted
* @returns delay in milliseconds
*/
* @param retryNumber - the number of retries that have already been attempted
* @returns delay in milliseconds
*/
- public static exponentialDelay(retryNumber = 0): number {
+ public static exponentialDelay(retryNumber = 0
, maxDelayRatio = 0.2
): number {
const delay = Math.pow(2, retryNumber) * 100;
const delay = Math.pow(2, retryNumber) * 100;
- const randomSum = delay *
0.2
* Utils.secureRandom(); // 0-20% of the delay
+ const randomSum = delay *
maxDelayRatio
* Utils.secureRandom(); // 0-20% of the delay
return delay + randomSum;
}
return delay + randomSum;
}