@ejfdelgado/ejflab-common 1.16.0 → 1.16.1
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/MyDates.js +5 -2
- package/src/MyTemplate.test.js +40 -1
- package/src/MyTensorflow.test.js +1 -1
package/package.json
CHANGED
package/src/MyDates.js
CHANGED
|
@@ -449,11 +449,14 @@ class MyDates {
|
|
|
449
449
|
return hDisplay + mDisplay + sDisplay;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
static age(dateMillis) {
|
|
452
|
+
static age(dateMillis, currentMillis = null) {
|
|
453
|
+
if (!(typeof currentMillis == "number")) {
|
|
454
|
+
currentMillis = new Date().getTime();
|
|
455
|
+
}
|
|
453
456
|
if (typeof dateMillis == 'number' && !isNaN(dateMillis)) {
|
|
454
457
|
const dateOfBirth = new Date(dateMillis);
|
|
455
458
|
const dayOfBirth = dateOfBirth.getDate();
|
|
456
|
-
const millisDifference =
|
|
459
|
+
const millisDifference = currentMillis - dateOfBirth.getTime();
|
|
457
460
|
const date = new Date(millisDifference);
|
|
458
461
|
const years = date.getFullYear() - 1970;
|
|
459
462
|
const months = date.getMonth();
|
package/src/MyTemplate.test.js
CHANGED
|
@@ -94,6 +94,45 @@ function myTest() {
|
|
|
94
94
|
exp: "My nada",
|
|
95
95
|
skipUndefined: false,
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
txt: ' $[for el1 in ${abuelo}] $[for el2 in ${el1.padre}] $[for el3 in ${el2.hijo}] ${el3.name} $[endfor] $[endfor] $[endfor] ',
|
|
99
|
+
data: {
|
|
100
|
+
abuelo: [
|
|
101
|
+
{
|
|
102
|
+
padre: [
|
|
103
|
+
{
|
|
104
|
+
hijo: [
|
|
105
|
+
{name: "Hugo"}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
hijo: [
|
|
110
|
+
{name: "Paco"}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
hijo: [
|
|
115
|
+
{name: "Luis"}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
exp: " Hugo Paco Luis ",
|
|
123
|
+
skipUndefined: false,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
txt: "$[if ${choice_id} == null]NULL$[else]'${choice_id}'::uuid$[endif],",
|
|
127
|
+
data: {
|
|
128
|
+
choice_id: '3764d5b2-75ec-44fd-89e0-9414f12d5b60',
|
|
129
|
+
assessment_answered_id: '51b62095-b14b-42b2-931e-c8872ab72b6a',
|
|
130
|
+
question_id: 'a48dd6db-0243-4faf-bbbd-dd808e253025',
|
|
131
|
+
date_of_response: 1741050236700
|
|
132
|
+
},
|
|
133
|
+
exp: "'3764d5b2-75ec-44fd-89e0-9414f12d5b60'::uuid,",
|
|
134
|
+
skipUndefined: false,
|
|
135
|
+
},
|
|
97
136
|
];
|
|
98
137
|
|
|
99
138
|
renderer.registerFunction("json", CsvFormatterFilters.json);
|
|
@@ -111,7 +150,7 @@ function myTest() {
|
|
|
111
150
|
const actual = renderer.render(myCase.txt, myCase.data, myCase.skipUndefined === true);
|
|
112
151
|
//console.log(actual);
|
|
113
152
|
if (actual !== myCase.exp) {
|
|
114
|
-
throw Error(`expected:\n${myCase.exp}\nactual:\n${actual}`);
|
|
153
|
+
throw Error(`expected:\n${JSON.stringify(myCase.exp)}\nactual:\n${JSON.stringify(actual)}`);
|
|
115
154
|
} else {
|
|
116
155
|
console.log(`case ${i + 1} OK!`);
|
|
117
156
|
}
|
package/src/MyTensorflow.test.js
CHANGED
|
@@ -2,7 +2,7 @@ const { MyTensorflow } = require("./MyTensorflow");
|
|
|
2
2
|
const tf = require('@tensorflow/tfjs');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
|
|
5
|
-
const test = () => {
|
|
5
|
+
const test = async () => {
|
|
6
6
|
|
|
7
7
|
const csvText = fs.readFileSync("./data/tensordata.csv", { encoding: "utf8" });
|
|
8
8
|
const csvTestText = fs.readFileSync("./data/tensordata.test.csv", { encoding: "utf8" });
|