@ejfdelgado/ejflab-common 1.0.0

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 (88) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +2 -0
  3. package/package.json +29 -0
  4. package/src/CollisionsEngine.js +252 -0
  5. package/src/CsvFormatter.js +54 -0
  6. package/src/CsvFormatter.test.js +119 -0
  7. package/src/CsvFormatterFilters.js +79 -0
  8. package/src/CsvParser.js +51 -0
  9. package/src/CsvParser.test.js +41 -0
  10. package/src/CsvWithFilters.js +114 -0
  11. package/src/FaceEncoder.js +64 -0
  12. package/src/FlowChartDiagram.js +503 -0
  13. package/src/IdGen.js +211 -0
  14. package/src/ModuloDatoSeguro.js +142 -0
  15. package/src/ModuloDatoSeguro.test.js +29 -0
  16. package/src/ModuloDatoSeguro.test.mjs +45 -0
  17. package/src/ModuloDatoSeguroBack.mjs +55 -0
  18. package/src/ModuloDatoSeguroFront.js +73 -0
  19. package/src/ModuloSonido.js +83 -0
  20. package/src/ModuloVideos.js +51 -0
  21. package/src/MyColor.js +136 -0
  22. package/src/MyColor.test.js +37 -0
  23. package/src/MyConstants.js +147 -0
  24. package/src/MyCookies.js +34 -0
  25. package/src/MyDates.js +412 -0
  26. package/src/MyDates.test.js +26 -0
  27. package/src/MyDatesBack.mjs +21 -0
  28. package/src/MyDatesFront.js +41 -0
  29. package/src/MyJsPdf.js +52 -0
  30. package/src/MyRoutes.js +29 -0
  31. package/src/MyTemplate.js +272 -0
  32. package/src/MyTemplate.test.js +90 -0
  33. package/src/MyTensorflow.js +248 -0
  34. package/src/MyTensorflow.test.js +19 -0
  35. package/src/MyTensorflowBack.mjs +33 -0
  36. package/src/MyThrottle.js +80 -0
  37. package/src/MyTuples.js +445 -0
  38. package/src/MyTuples.test.js +330 -0
  39. package/src/MyUtilities.js +137 -0
  40. package/src/SimpleObj.js +153 -0
  41. package/src/SimpleObj.test.js +58 -0
  42. package/src/TriangulacionGeometric.js +335 -0
  43. package/src/changePath.js +38 -0
  44. package/src/data/case0.csv +3 -0
  45. package/src/data/case0.json +24 -0
  46. package/src/data/case1.csv +2 -0
  47. package/src/data/case1.json +24 -0
  48. package/src/data/case2.csv +3 -0
  49. package/src/data/case2.json +24 -0
  50. package/src/data/case3.csv +3 -0
  51. package/src/data/case3.json +24 -0
  52. package/src/data/format0.json +0 -0
  53. package/src/data/format0.txt +1 -0
  54. package/src/data/tensordata.csv +10 -0
  55. package/src/data/tensordata.json +37 -0
  56. package/src/data/tensordata.test.csv +10 -0
  57. package/src/data/tensormodel.json +113 -0
  58. package/src/fft.js +224 -0
  59. package/src/flowchart/FlowChartExec.js +763 -0
  60. package/src/flowchart/steps/CommandBasic.js +32 -0
  61. package/src/flowchart/steps/CommandInc.js +19 -0
  62. package/src/flowchart/steps/CommandMilvus.js +47 -0
  63. package/src/flowchart/steps/CommandMinio.js +28 -0
  64. package/src/flowchart/steps/CommandMongo.js +59 -0
  65. package/src/flowchart/steps/CommandPrint.js +12 -0
  66. package/src/flowchart/steps/CommandSet.js +14 -0
  67. package/src/flowchart/steps/CommandTimeline.js +21 -0
  68. package/src/flowchart/steps/CommandTimelineNext.js +28 -0
  69. package/src/flowchart/steps/StepBasic.js +184 -0
  70. package/src/flowchart/steps/StepCheckProcessor.js +26 -0
  71. package/src/flowchart/steps/StepCheckSrc.js +42 -0
  72. package/src/flowchart/steps/StepIsTrue.js +12 -0
  73. package/src/flowchart/steps/StepOneTime.js +21 -0
  74. package/src/flowchart/steps/StepProcess.js +163 -0
  75. package/src/flowchart/steps/StepReadSrc.js +66 -0
  76. package/src/flowchart/steps/StepSleep.js +22 -0
  77. package/src/flowchart/steps/StepTimeLineEnds.js +21 -0
  78. package/src/flowchart/steps/StepTimeLineHasMore.js +16 -0
  79. package/src/gif/index.d.ts +20 -0
  80. package/src/gif/index.mjs +85 -0
  81. package/src/gif/utils/checkTypes.d.ts +2 -0
  82. package/src/gif/utils/checkTypes.mjs +11 -0
  83. package/src/js-colormaps.js +19484 -0
  84. package/src/sortify.js +75 -0
  85. package/src/sqlmodelparser/SqlModelParser.js +22 -0
  86. package/src/test/csv/test_1000_20230429204538700.csv +1001 -0
  87. package/src/test/csv/test_5_20230429204525930.csv +6 -0
  88. package/src/test/svg/test.html +5 -0
package/src/sortify.js ADDED
@@ -0,0 +1,75 @@
1
+ /*!
2
+ * Copyright 2015-2017 Thomas Rosenau
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ 'use strict';
17
+
18
+ /**
19
+ * Create a “sorted” version of an object.
20
+ *
21
+ * JS engines internally keep track of an object's keys in the order of
22
+ * creation time, i.e. {a:1,b:2} is treated differently from {b:2,a:1}.
23
+ * That difference can be seen when JSON.stringify is called on that object.
24
+ * This function normalizes any kind of object by rearranging the keys in
25
+ * alphabetical order (numerical keys first, since v8 does so, and there's
26
+ * nothing we can do about it).
27
+ * @param {*} o The object to be sorted
28
+ */
29
+ const sortKeys = o => {
30
+ if (Array.isArray(o)) {
31
+ return o.map(sortKeys);
32
+ }
33
+ if (o instanceof Object) {
34
+ // put numeric keys first
35
+ let numeric = [];
36
+ let nonNumeric = [];
37
+ Object.keys(o).forEach(key => {
38
+ if (/^(0|[1-9][0-9]*)$/.test(key)) {
39
+ numeric.push(+key);
40
+ } else {
41
+ nonNumeric.push(key);
42
+ }
43
+ });
44
+ // do the rearrangement
45
+ return numeric.sort((a, b) => a - b).concat(nonNumeric.sort()).reduce((result, key) => {
46
+ result[key] = sortKeys(o[key]); // recurse!
47
+ return result;
48
+ }, {});
49
+ }
50
+ return o;
51
+ };
52
+
53
+ const jsonStringify = JSON.stringify.bind(JSON); // this allows redefinition like JSON.stringify = require('json.sortify')
54
+
55
+ const sortify = (value, space) => {
56
+ let cache = [];
57
+ // replacer, toJSON(), cyclic references and other stuff is better handled by native stringifier.
58
+ // So we do JSON.stringify(sortKeys( JSON.parse(JSON.stringify()) )).
59
+ // This approach is slightly slower but much safer than a manual stringification.
60
+ let nativeJson = jsonStringify(value, (key, value) => {
61
+ if (typeof value === 'object' && value !== null) {
62
+ if (cache.includes(value)) return;
63
+ cache.push(value);
64
+ }
65
+ return value;
66
+ }, 0);
67
+ cache = null;
68
+ if (!nativeJson || nativeJson[0] !== '{' && nativeJson[0] !== '[') { // if value is not an Object or Array
69
+ return nativeJson;
70
+ }
71
+ let cleanObj = JSON.parse(nativeJson);
72
+ return jsonStringify(sortKeys(cleanObj), null, space);
73
+ };
74
+
75
+ module.exports = sortify;
@@ -0,0 +1,22 @@
1
+
2
+ const { XMLParser } = require("fast-xml-parser");
3
+ const { MyUtilities } = require("../MyUtilities");
4
+ const { MyTemplate } = require("../MyTemplate");
5
+
6
+ class SqlModelParser {
7
+ static parseTable() {
8
+
9
+ }
10
+ static parseTables(rawText) {
11
+ const options = {
12
+ ignoreAttributes: false,
13
+ };
14
+ const parser = new XMLParser(options);
15
+ const xmlFlow = parser.parse(rawText);
16
+ console.log(JSON.stringify(xmlFlow, null, 4));
17
+ }
18
+ }
19
+
20
+ module.exports = {
21
+ SqlModelParser
22
+ }