ismx-nexo-node-app 0.4.142 → 0.4.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,8 +5,11 @@ class NumberUtils {
|
|
|
5
5
|
return Math.floor(Math.random() * (upper + 1 - lower)) + lower;
|
|
6
6
|
}
|
|
7
7
|
static duration(seconds) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (seconds == null)
|
|
9
|
+
return null;
|
|
10
|
+
const truncated = Math.trunc(seconds);
|
|
11
|
+
const mins = Math.floor(truncated / 60);
|
|
12
|
+
const secs = truncated % 60;
|
|
10
13
|
const minsStr = mins.toString().padStart(2, '0');
|
|
11
14
|
const secsStr = secs.toString().padStart(2, '0');
|
|
12
15
|
return `${minsStr}:${secsStr}`;
|
package/package.json
CHANGED
|
@@ -4,9 +4,13 @@ export default abstract class NumberUtils {
|
|
|
4
4
|
return Math.floor(Math.random() * (upper + 1 - lower)) + lower;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
static duration(seconds: number): string
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
static duration(seconds: number): string;
|
|
8
|
+
static duration(seconds: null | undefined): null;
|
|
9
|
+
static duration(seconds: number | null | undefined): string | null {
|
|
10
|
+
if (seconds == null) return null;
|
|
11
|
+
const truncated = Math.trunc(seconds);
|
|
12
|
+
const mins = Math.floor(truncated / 60);
|
|
13
|
+
const secs = truncated % 60;
|
|
10
14
|
const minsStr = mins.toString().padStart(2, '0');
|
|
11
15
|
const secsStr = secs.toString().padStart(2, '0');
|
|
12
16
|
return `${minsStr}:${secsStr}`;
|