@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.
- package/LICENSE +201 -0
- package/README.md +2 -0
- package/package.json +29 -0
- package/src/CollisionsEngine.js +252 -0
- package/src/CsvFormatter.js +54 -0
- package/src/CsvFormatter.test.js +119 -0
- package/src/CsvFormatterFilters.js +79 -0
- package/src/CsvParser.js +51 -0
- package/src/CsvParser.test.js +41 -0
- package/src/CsvWithFilters.js +114 -0
- package/src/FaceEncoder.js +64 -0
- package/src/FlowChartDiagram.js +503 -0
- package/src/IdGen.js +211 -0
- package/src/ModuloDatoSeguro.js +142 -0
- package/src/ModuloDatoSeguro.test.js +29 -0
- package/src/ModuloDatoSeguro.test.mjs +45 -0
- package/src/ModuloDatoSeguroBack.mjs +55 -0
- package/src/ModuloDatoSeguroFront.js +73 -0
- package/src/ModuloSonido.js +83 -0
- package/src/ModuloVideos.js +51 -0
- package/src/MyColor.js +136 -0
- package/src/MyColor.test.js +37 -0
- package/src/MyConstants.js +147 -0
- package/src/MyCookies.js +34 -0
- package/src/MyDates.js +412 -0
- package/src/MyDates.test.js +26 -0
- package/src/MyDatesBack.mjs +21 -0
- package/src/MyDatesFront.js +41 -0
- package/src/MyJsPdf.js +52 -0
- package/src/MyRoutes.js +29 -0
- package/src/MyTemplate.js +272 -0
- package/src/MyTemplate.test.js +90 -0
- package/src/MyTensorflow.js +248 -0
- package/src/MyTensorflow.test.js +19 -0
- package/src/MyTensorflowBack.mjs +33 -0
- package/src/MyThrottle.js +80 -0
- package/src/MyTuples.js +445 -0
- package/src/MyTuples.test.js +330 -0
- package/src/MyUtilities.js +137 -0
- package/src/SimpleObj.js +153 -0
- package/src/SimpleObj.test.js +58 -0
- package/src/TriangulacionGeometric.js +335 -0
- package/src/changePath.js +38 -0
- package/src/data/case0.csv +3 -0
- package/src/data/case0.json +24 -0
- package/src/data/case1.csv +2 -0
- package/src/data/case1.json +24 -0
- package/src/data/case2.csv +3 -0
- package/src/data/case2.json +24 -0
- package/src/data/case3.csv +3 -0
- package/src/data/case3.json +24 -0
- package/src/data/format0.json +0 -0
- package/src/data/format0.txt +1 -0
- package/src/data/tensordata.csv +10 -0
- package/src/data/tensordata.json +37 -0
- package/src/data/tensordata.test.csv +10 -0
- package/src/data/tensormodel.json +113 -0
- package/src/fft.js +224 -0
- package/src/flowchart/FlowChartExec.js +763 -0
- package/src/flowchart/steps/CommandBasic.js +32 -0
- package/src/flowchart/steps/CommandInc.js +19 -0
- package/src/flowchart/steps/CommandMilvus.js +47 -0
- package/src/flowchart/steps/CommandMinio.js +28 -0
- package/src/flowchart/steps/CommandMongo.js +59 -0
- package/src/flowchart/steps/CommandPrint.js +12 -0
- package/src/flowchart/steps/CommandSet.js +14 -0
- package/src/flowchart/steps/CommandTimeline.js +21 -0
- package/src/flowchart/steps/CommandTimelineNext.js +28 -0
- package/src/flowchart/steps/StepBasic.js +184 -0
- package/src/flowchart/steps/StepCheckProcessor.js +26 -0
- package/src/flowchart/steps/StepCheckSrc.js +42 -0
- package/src/flowchart/steps/StepIsTrue.js +12 -0
- package/src/flowchart/steps/StepOneTime.js +21 -0
- package/src/flowchart/steps/StepProcess.js +163 -0
- package/src/flowchart/steps/StepReadSrc.js +66 -0
- package/src/flowchart/steps/StepSleep.js +22 -0
- package/src/flowchart/steps/StepTimeLineEnds.js +21 -0
- package/src/flowchart/steps/StepTimeLineHasMore.js +16 -0
- package/src/gif/index.d.ts +20 -0
- package/src/gif/index.mjs +85 -0
- package/src/gif/utils/checkTypes.d.ts +2 -0
- package/src/gif/utils/checkTypes.mjs +11 -0
- package/src/js-colormaps.js +19484 -0
- package/src/sortify.js +75 -0
- package/src/sqlmodelparser/SqlModelParser.js +22 -0
- package/src/test/csv/test_1000_20230429204538700.csv +1001 -0
- package/src/test/csv/test_5_20230429204525930.csv +6 -0
- package/src/test/svg/test.html +5 -0
package/src/MyColor.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
|
|
2
|
+
class MyColor {
|
|
3
|
+
static colorhex2int(rrggbb) {
|
|
4
|
+
const parts = /#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(rrggbb);
|
|
5
|
+
if (parts) {
|
|
6
|
+
return {
|
|
7
|
+
r: parseInt(parts[1], 16),
|
|
8
|
+
g: parseInt(parts[2], 16),
|
|
9
|
+
b: parseInt(parts[3], 16),
|
|
10
|
+
}
|
|
11
|
+
} else {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
static valueToHex(c) {
|
|
16
|
+
let hex = c.toString(16);
|
|
17
|
+
return ('0' + hex).slice(-2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static int2colorhex(num) {
|
|
21
|
+
const val = MyColor.int2color(num);
|
|
22
|
+
return `#${MyColor.valueToHex(val.r)}${MyColor.valueToHex(val.g)}${MyColor.valueToHex(val.b)}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static getStepColors(max) {
|
|
26
|
+
const mapa = {};
|
|
27
|
+
for (let i = 0; i < max; i++) {
|
|
28
|
+
mapa[i] = MyColor.int2colorhex(i);
|
|
29
|
+
}
|
|
30
|
+
return mapa;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static getMapMagicNumber(num) {
|
|
34
|
+
//1
|
|
35
|
+
//0.5, *
|
|
36
|
+
//0.25, *, 0.75
|
|
37
|
+
//0.125, *, 0.375, *, 0.625, *, 0.875
|
|
38
|
+
//0.0625, *, 0.1875, *, 0.3125, *, 0.4375, *, 0.5625, *, 0.6875, *, 0.8125, *, 0.9375
|
|
39
|
+
//0.03125, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, 0.90625, 0.96875
|
|
40
|
+
const map = [1, 0.5, 0.25, 0.75, 0.125, 0.375, 0.625, 0.875, 0.0625, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, 0.8125, 0.9375, 0.03125, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375, 0.90625, 0.96875];
|
|
41
|
+
const magico = map[(num - 1) % map.length];
|
|
42
|
+
return magico;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static int2color(num) {
|
|
46
|
+
|
|
47
|
+
if (num == 0) {
|
|
48
|
+
return { r: 255, g: 255, b: 255 };
|
|
49
|
+
} else {
|
|
50
|
+
const magico = MyColor.getMapMagicNumber(num);
|
|
51
|
+
return MyColor.hsv2rgb(magico, 1, 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static int2HueDegree(num) {
|
|
55
|
+
const magico = MyColor.getMapMagicNumber(num);
|
|
56
|
+
return 360 * magico;
|
|
57
|
+
}
|
|
58
|
+
// 0 <= h, s, v <= 1
|
|
59
|
+
// 0 <= r, g, b <= 255
|
|
60
|
+
static hsv2rgb(h, s, v) {
|
|
61
|
+
var r, g, b, i, f, p, q, t;
|
|
62
|
+
if (arguments.length === 1) {
|
|
63
|
+
s = h.s, v = h.v, h = h.h;
|
|
64
|
+
}
|
|
65
|
+
i = Math.floor(h * 6);
|
|
66
|
+
f = h * 6 - i;
|
|
67
|
+
p = v * (1 - s);
|
|
68
|
+
q = v * (1 - f * s);
|
|
69
|
+
t = v * (1 - (1 - f) * s);
|
|
70
|
+
switch (i % 6) {
|
|
71
|
+
case 0: r = v, g = t, b = p; break;
|
|
72
|
+
case 1: r = q, g = v, b = p; break;
|
|
73
|
+
case 2: r = p, g = v, b = t; break;
|
|
74
|
+
case 3: r = p, g = q, b = v; break;
|
|
75
|
+
case 4: r = t, g = p, b = v; break;
|
|
76
|
+
case 5: r = v, g = p, b = q; break;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
r: Math.round(r * 255),
|
|
80
|
+
g: Math.round(g * 255),
|
|
81
|
+
b: Math.round(b * 255)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static rgb2hsv(r, g, b) {
|
|
86
|
+
let rabs, gabs, babs, rr, gg, bb, h, s, v, diff, diffc, percentRoundFn;
|
|
87
|
+
rabs = r / 255;
|
|
88
|
+
gabs = g / 255;
|
|
89
|
+
babs = b / 255;
|
|
90
|
+
v = Math.max(rabs, gabs, babs),
|
|
91
|
+
diff = v - Math.min(rabs, gabs, babs);
|
|
92
|
+
diffc = c => (v - c) / 6 / diff + 1 / 2;
|
|
93
|
+
percentRoundFn = num => Math.round(num * 100) / 100;
|
|
94
|
+
if (diff == 0) {
|
|
95
|
+
h = s = 0;
|
|
96
|
+
} else {
|
|
97
|
+
s = diff / v;
|
|
98
|
+
rr = diffc(rabs);
|
|
99
|
+
gg = diffc(gabs);
|
|
100
|
+
bb = diffc(babs);
|
|
101
|
+
|
|
102
|
+
if (rabs === v) {
|
|
103
|
+
h = bb - gg;
|
|
104
|
+
} else if (gabs === v) {
|
|
105
|
+
h = (1 / 3) + rr - bb;
|
|
106
|
+
} else if (babs === v) {
|
|
107
|
+
h = (2 / 3) + gg - rr;
|
|
108
|
+
}
|
|
109
|
+
if (h < 0) {
|
|
110
|
+
h += 1;
|
|
111
|
+
} else if (h > 1) {
|
|
112
|
+
h -= 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
h: h * 360,
|
|
117
|
+
s: percentRoundFn(s * 100),
|
|
118
|
+
v: percentRoundFn(v * 100)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
static interpolateClamp({ val, inMin, inMax, outMin, outMax }) {
|
|
122
|
+
if (val < inMin) {
|
|
123
|
+
val = inMin;
|
|
124
|
+
} else if (val > inMax) {
|
|
125
|
+
val = inMax;
|
|
126
|
+
}
|
|
127
|
+
return ((val - inMin) / (inMax - inMin)) * (outMax - outMin) + outMin;
|
|
128
|
+
}
|
|
129
|
+
static interpolate({ val, inMin, inMax, outMin, outMax }) {
|
|
130
|
+
return ((val - inMin) / (inMax - inMin)) * (outMax - outMin) + outMin;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = {
|
|
135
|
+
MyColor
|
|
136
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { MyColor } = require("./MyColor");
|
|
2
|
+
|
|
3
|
+
function test1() {
|
|
4
|
+
const pruebas = [
|
|
5
|
+
{ h: 1, s: 1, v: 1 },
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < pruebas.length; i++) {
|
|
9
|
+
const prueba = pruebas[i];
|
|
10
|
+
const response = MyColor.hsv2rgb(prueba.h, prueba.s, prueba.v);
|
|
11
|
+
console.log(JSON.stringify(response));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < 100; i++) {
|
|
15
|
+
console.log(MyColor.int2colorhex(i));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function test2() {
|
|
20
|
+
const pruebas = [
|
|
21
|
+
{ val: 0, inMin: 0, inMax: 1, outMin: 10, outMax: 20, expected: 10 },
|
|
22
|
+
{ val: -15, inMin: 0, inMax: 1, outMin: 10, outMax: 20, expected: 10 },
|
|
23
|
+
{ val: 0, inMin: -1, inMax: 1, outMin: 10, outMax: 20, expected: 15 },
|
|
24
|
+
{ val: -10, inMin: -1, inMax: 1, outMin: 10, outMax: 20, expected: 10 },
|
|
25
|
+
{ val: 100, inMin: 0, inMax: 1, outMin: 10, outMax: 50, expected: 50 },
|
|
26
|
+
{ val: 250, inMin: 0, inMax: 500, outMin: 0, outMax: 1, expected: 0.5 },
|
|
27
|
+
];
|
|
28
|
+
for (let i = 0; i < pruebas.length; i++) {
|
|
29
|
+
const argumentos = pruebas[i];
|
|
30
|
+
const ans = MyColor.interpolateClamp(argumentos);
|
|
31
|
+
if (ans != argumentos.expected) {
|
|
32
|
+
throw new Error(`Se esperaba ${argumentos.expected} pero se obtuvo ${ans} con ${JSON.stringify(argumentos)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
test2();
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
class MyConstants {
|
|
2
|
+
static EMAIL_SENDER = "edgar.jose.fernando.delgado@gmail.com";
|
|
3
|
+
// Modify the nginx rewrite /app1/(.*) /$1 break;
|
|
4
|
+
static SRV_ROOT = "/";
|
|
5
|
+
static SOCKET_IO_ROOT = MyConstants.SRV_ROOT;
|
|
6
|
+
static NO_AUTO_PAGE_NAVITATION = ["/guides", "/assessment"];
|
|
7
|
+
static CLOUD_RUN_URL = "https://mainapp-7b6hvjg6ia-uc.a.run.app/";
|
|
8
|
+
static FIREBASE_CONFIG_FILE = "./credentials/firebase.pro.json";
|
|
9
|
+
static DOMAIN_ROUTER = {
|
|
10
|
+
"srv/opencv/solvepnp": MyConstants.CLOUD_RUN_URL
|
|
11
|
+
};
|
|
12
|
+
static ANONYMOUS_PATHS = ['/uechat', '/call', '/nogales'];
|
|
13
|
+
static BUCKET = {
|
|
14
|
+
URL_BASE: "https://storage.googleapis.com",
|
|
15
|
+
PUBLIC: `labs-pro-public`,
|
|
16
|
+
PRIVATE: `labs-pro-private`,
|
|
17
|
+
MAX_MB: 50,
|
|
18
|
+
}
|
|
19
|
+
static USER = {
|
|
20
|
+
DEFAULT_IMAGE: './assets/img/defavatar.jpg',
|
|
21
|
+
DEFAULT_FOLDER: "profile",
|
|
22
|
+
DEFAULT_FILE: "/me.jpg",
|
|
23
|
+
};
|
|
24
|
+
static PAGE = {
|
|
25
|
+
DEFAULT_IMAGE: './assets/img/defaultPage.jpg',
|
|
26
|
+
NO_IMAGE: './assets/img/noimage.jpg',
|
|
27
|
+
defaults: {
|
|
28
|
+
cv: {
|
|
29
|
+
publicRole: "reader",
|
|
30
|
+
image: './assets/img/defaultPage.jpg',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
static AUTH_READ = ["fil_r", "pg_r", "tup_r"];
|
|
35
|
+
static AUTH_WRITE = ["fil_w", "tup_w"];
|
|
36
|
+
static AUTH_OWNER = ["per_r", "per_w", "pg_w"];
|
|
37
|
+
static ROLES = [
|
|
38
|
+
{ id: "none", txt: "Ninguno", auth: [] },
|
|
39
|
+
{ id: "reader", txt: "Lector", auth: MyConstants.AUTH_READ },
|
|
40
|
+
{ id: "editor", txt: "Editor", auth: MyConstants.AUTH_READ.concat(MyConstants.AUTH_WRITE) },
|
|
41
|
+
{ id: "owner", txt: "Dueño", auth: MyConstants.AUTH_READ.concat(MyConstants.AUTH_WRITE).concat(MyConstants.AUTH_OWNER) },
|
|
42
|
+
];
|
|
43
|
+
static getDefaultPageImage(pageType) {
|
|
44
|
+
pageType = pageType.replace(/^\//, '');
|
|
45
|
+
if (pageType in MyConstants.PAGE.defaults) {
|
|
46
|
+
const actual = MyConstants.PAGE.defaults[pageType];
|
|
47
|
+
if (actual.image) {
|
|
48
|
+
return actual.image;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return MyConstants.PAGE.DEFAULT_IMAGE;
|
|
52
|
+
}
|
|
53
|
+
static getDefaultPublicPageRole(pageType) {
|
|
54
|
+
pageType = pageType.replace(/^\//, '');
|
|
55
|
+
if (pageType in MyConstants.PAGE.defaults) {
|
|
56
|
+
const actual = MyConstants.PAGE.defaults[pageType];
|
|
57
|
+
if (actual.publicRole) {
|
|
58
|
+
return actual.publicRole;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return "none";
|
|
62
|
+
}
|
|
63
|
+
static getAuthByRole(role) {
|
|
64
|
+
for (let i = 0; i < MyConstants.ROLES.length; i++) {
|
|
65
|
+
const actual = MyConstants.ROLES[i];
|
|
66
|
+
if (role == actual.id) {
|
|
67
|
+
return actual.auth;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
static getSpeechToTextServer(language) {
|
|
73
|
+
if (language == "en") {
|
|
74
|
+
let SPEECH_TO_TEXT_SERVER = `wss://${location?.hostname}/ws_en`;
|
|
75
|
+
if (location.hostname == "localhost") {
|
|
76
|
+
SPEECH_TO_TEXT_SERVER = "ws://localhost:2701";
|
|
77
|
+
}
|
|
78
|
+
return SPEECH_TO_TEXT_SERVER;
|
|
79
|
+
} else {
|
|
80
|
+
let SPEECH_TO_TEXT_SERVER = `wss://${location?.hostname}/ws`;
|
|
81
|
+
if (location.hostname == "localhost") {
|
|
82
|
+
SPEECH_TO_TEXT_SERVER = "ws://localhost:2700";
|
|
83
|
+
}
|
|
84
|
+
return SPEECH_TO_TEXT_SERVER;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
static resolveDomain(path) {
|
|
88
|
+
if (/https?:\/\//.test(path)) {
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
if (location.hostname == "localhost") {
|
|
92
|
+
return MyConstants.SRV_ROOT;
|
|
93
|
+
}
|
|
94
|
+
let domain = MyConstants.DOMAIN_ROUTER[path];
|
|
95
|
+
if (!domain) {
|
|
96
|
+
return MyConstants.SRV_ROOT;
|
|
97
|
+
} else {
|
|
98
|
+
return domain;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//MyConstants.getPublicUrl()
|
|
102
|
+
static getPublicUrl(keyName, addRandom = true) {
|
|
103
|
+
keyName = keyName.replace(/\?.*$/, "");
|
|
104
|
+
if (addRandom) {
|
|
105
|
+
const time = new Date().getTime();
|
|
106
|
+
return `${MyConstants.BUCKET.URL_BASE}/${MyConstants.BUCKET.PUBLIC}/${keyName}?t=${time}`;
|
|
107
|
+
} else {
|
|
108
|
+
return `${MyConstants.BUCKET.URL_BASE}/${MyConstants.BUCKET.PUBLIC}/${keyName}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static getCompleteUrl(url) {
|
|
113
|
+
if (url == null) {
|
|
114
|
+
throw new Error('Can not read null url');
|
|
115
|
+
}
|
|
116
|
+
let theUrl = url;
|
|
117
|
+
if (typeof MyConstants.SRV_ROOT == 'string') {
|
|
118
|
+
theUrl = MyConstants.SRV_ROOT + url.replace(/^\/+/, '');
|
|
119
|
+
}
|
|
120
|
+
if (theUrl.startsWith('/')) {
|
|
121
|
+
theUrl = `${location.origin}${theUrl}`;
|
|
122
|
+
}
|
|
123
|
+
return theUrl;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static getSuffixPath(keyName, suffix) {
|
|
127
|
+
const keyNameXs = keyName.replace(/^(.+)\.([^./]+)$/ig, `$1${suffix}.$2`);
|
|
128
|
+
if (keyNameXs == keyName) {
|
|
129
|
+
// fallback when no extension
|
|
130
|
+
return keyName + suffix;
|
|
131
|
+
}
|
|
132
|
+
return keyNameXs;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
if (location.port == "4200") {
|
|
138
|
+
// Translate the port to backend services when angular development is running
|
|
139
|
+
MyConstants.SRV_ROOT = `http://${location.hostname}:8081/`;
|
|
140
|
+
}
|
|
141
|
+
} catch (err) {
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
module.exports = {
|
|
146
|
+
MyConstants
|
|
147
|
+
};
|
package/src/MyCookies.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
class MyCookies {
|
|
3
|
+
static setCookie(cname, cvalue, exdays = 10000) {
|
|
4
|
+
const d = new Date();
|
|
5
|
+
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
|
|
6
|
+
let expires = 'expires=' + d.toUTCString();
|
|
7
|
+
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static getCookie(cname) {
|
|
11
|
+
let name = cname + '=';
|
|
12
|
+
let decodedCookie = decodeURIComponent(document.cookie);
|
|
13
|
+
let ca = decodedCookie.split(';');
|
|
14
|
+
for (let i = 0; i < ca.length; i++) {
|
|
15
|
+
let c = ca[i];
|
|
16
|
+
while (c.charAt(0) == ' ') {
|
|
17
|
+
c = c.substring(1);
|
|
18
|
+
}
|
|
19
|
+
if (c.indexOf(name) == 0) {
|
|
20
|
+
return c.substring(name.length, c.length);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static deleteCookie(cname) {
|
|
27
|
+
document.cookie =
|
|
28
|
+
cname + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
MyCookies
|
|
34
|
+
};
|