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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +11 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "og-tools",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -84,19 +84,17 @@ function scoreRatio(calificacion) {
84
84
  return null;
85
85
  }
86
86
 
87
- function DaysBetween(timestamp1, timestamp2) {
88
- try {
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
- const diferencia = Math.abs(ms2 - ms1);
94
- const dias = Math.floor(diferencia / (1000 * 60 * 60 * 24));
90
+ const n1 = Number(ts1);
91
+ const n2 = Number(ts2);
95
92
 
96
- return dias;
97
- } catch (e) {
98
- return { ok: false, error: { code: e.message, message: e.stack } };
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
  };