og-tools 0.0.7 → 0.0.8
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.
- package/package.json +1 -1
- package/src/index.js +11 -13
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -84,19 +84,17 @@ function scoreRatio(calificacion) {
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
function DaysBetween(
|
|
88
|
-
|
|
89
|
-
if(parseInt(timestamp1) === 0 || parseInt(timestamp1) === 0) return 0;
|
|
90
|
-
const ms1 = parseInt(timestamp1) * 1000;
|
|
91
|
-
const ms2 = parseInt(timestamp2) * 1000;
|
|
87
|
+
function DaysBetween(ts1, ts2) {
|
|
88
|
+
if (ts1 == null || ts2 == null) return 0;
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
const n1 = Number(ts1);
|
|
91
|
+
const n2 = Number(ts2);
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (isNaN(n1) || isNaN(n2)) return 0;
|
|
94
|
+
if (n1 === 0 || n2 === 0) return 0;
|
|
95
|
+
|
|
96
|
+
const diferencia = Math.abs(n2 - n1);
|
|
97
|
+
return Math.floor(diferencia / (60 * 60 * 24));
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
function Distance(location1, location2, unit = 'km') {
|
|
@@ -130,10 +128,10 @@ function Distance(location1, location2, unit = 'km') {
|
|
|
130
128
|
|
|
131
129
|
|
|
132
130
|
module.exports = {
|
|
133
|
-
comillas,
|
|
131
|
+
comillas, // Reemplaza ' por spaces en string
|
|
134
132
|
correlateTournaments,
|
|
135
133
|
singleTournamentCorrelate,
|
|
136
|
-
scoreRatio,
|
|
134
|
+
scoreRatio, // Recibe una calificacion (6.62) y lo convierte en patrón emoji 🟡
|
|
137
135
|
Distance, // Calcula la distancia entre dos ubicaciones
|
|
138
136
|
DaysBetween, // Calcula el numero de días entre dos fechas
|
|
139
137
|
};
|