efront 4.23.6 → 4.23.7
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/coms/basic/JSAM.js +5 -5
- package/coms/basic/JSAM_test.js +23 -0
- package/coms/basic/strings.js +3 -1
- package/coms/basic_/JSON_test.js +23 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/public/pivot/page/auth/login.txt +1 -1
- package/public/pivot/page/cert/main.txt +1 -1
- package/public/pivot/page/cert/orders.txt +1 -1
- package/public/pivot/page/cert/update.txt +1 -1
- package/public/pivot/page/db/act.txt +1 -1
- package/public/pivot/page/db/config.txt +1 -1
- package/public/pivot/page/db/edit.txt +1 -1
- package/public/pivot/page/db/list.txt +1 -1
- package/public/pivot//344/270/273/351/241/265.html +2 -2
package/coms/basic/JSAM.js
CHANGED
|
@@ -21,7 +21,7 @@ var isValidK = function (k) {
|
|
|
21
21
|
return k.length < 16 && !/^\d|[,:'"\\\/`\-\[\]\{\}\(\)\.\+\#\@\&^]/.test(k) && spaces.trim(k) === k;
|
|
22
22
|
};
|
|
23
23
|
var extractK = function (k) {
|
|
24
|
-
return k
|
|
24
|
+
return /^\d{1,16}$/.test(k) && !/^0\d/.test(k);
|
|
25
25
|
};
|
|
26
26
|
var noDulp = false, plength = 0, dulp = false;
|
|
27
27
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
@@ -85,12 +85,12 @@ function _tostring(memery, preload, dist) {
|
|
|
85
85
|
v = _tostring(v, preload);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
if (k
|
|
89
|
-
arr.push(v);
|
|
88
|
+
if (extractK(k)) {
|
|
89
|
+
if (+k === inc) arr.push(v);
|
|
90
|
+
else arr.push("+" + k + ":" + v);
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
92
|
-
if (
|
|
93
|
-
else if (!isValidK(k)) k = string(String(k));
|
|
93
|
+
if (!isValidK(k)) k = string(String(k));
|
|
94
94
|
arr.push(k + ":" + v);
|
|
95
95
|
}
|
|
96
96
|
inc++;
|
package/coms/basic/JSAM_test.js
CHANGED
|
@@ -11,6 +11,10 @@ var test_self = function () {
|
|
|
11
11
|
test(null) // null;
|
|
12
12
|
test(undefined); // 空字符串
|
|
13
13
|
test(1); // 1
|
|
14
|
+
test([0]);
|
|
15
|
+
test(["00"]);
|
|
16
|
+
test({"0":"00"});
|
|
17
|
+
test({"00":"00"});
|
|
14
18
|
test(true); // true
|
|
15
19
|
test(false); // false
|
|
16
20
|
test(NaN); // NaN
|
|
@@ -328,6 +332,24 @@ function test_time() {
|
|
|
328
332
|
var t4 = gettime(() => JSAM.stringify(data, false));
|
|
329
333
|
console.log(t1, t2, t3, t4);
|
|
330
334
|
}
|
|
335
|
+
function test_encode() {
|
|
336
|
+
for (var cx = 0, dx = 0xffff; cx < dx; cx++) {
|
|
337
|
+
var str = String.fromCodePoint(cx);
|
|
338
|
+
var enc = JSAM.stringify(str);
|
|
339
|
+
var dec = JSAM.parse(enc);
|
|
340
|
+
assert(str, dec);
|
|
341
|
+
var obj = { [str]: str };
|
|
342
|
+
enc = JSAM.stringify(obj);
|
|
343
|
+
dec = JSAM.parse(enc);
|
|
344
|
+
if (!assert(dec, obj) || cx === 0x41) {
|
|
345
|
+
console.log(cx, str, cx.toString(16), enc);
|
|
346
|
+
};
|
|
347
|
+
obj = { [str]: obj, [enc]: obj };
|
|
348
|
+
enc = JSAM.stringify(obj);
|
|
349
|
+
dec = JSAM.parse(enc);
|
|
350
|
+
assert(dec, obj);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
331
353
|
function JSAM_test() {
|
|
332
354
|
test_self();
|
|
333
355
|
test_json();
|
|
@@ -336,4 +358,5 @@ function JSAM_test() {
|
|
|
336
358
|
test_parse();
|
|
337
359
|
JSAM.debug = false;
|
|
338
360
|
test_time();
|
|
361
|
+
test_encode();
|
|
339
362
|
}
|
package/coms/basic/strings.js
CHANGED
|
@@ -23,7 +23,9 @@ var unescapeUnc = function (a) {
|
|
|
23
23
|
}
|
|
24
24
|
return "\\u" + code;
|
|
25
25
|
};
|
|
26
|
-
var unescapeMap = {
|
|
26
|
+
var unescapeMap = {
|
|
27
|
+
"\\v": "\v",
|
|
28
|
+
};
|
|
27
29
|
for (var k in escapeMap) unescapeMap[escapeMap[k]] = k;
|
|
28
30
|
function encode(str, q = "\"", escapeUnicode = true) {
|
|
29
31
|
str = str.replace(new RegExp(`[\\\\${q}]`, 'g'), "\\$&");
|
package/coms/basic_/JSON_test.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var JSON0 = window.JSON;
|
|
2
|
-
console.log(JSON0);
|
|
3
2
|
var test = function (JSON) {
|
|
4
3
|
var parse = function (s) {
|
|
5
4
|
try {
|
|
@@ -172,10 +171,33 @@ var test2 = function (JSON) {
|
|
|
172
171
|
assert(JSON.parse(`{/*a*/"1":\r\n2}`), { "1": 2 })
|
|
173
172
|
assert(JSON.parse(`{"1/*a*/":\r\n2}`), { "1/*a*/": 2 })
|
|
174
173
|
}
|
|
174
|
+
var test3 = function (JSON) {
|
|
175
|
+
console.log(JSON, JSON0, JSON === JSON0);
|
|
176
|
+
var start_time = performance.now();
|
|
177
|
+
for (var cx = 0, dx = 0xffff; cx < dx; cx++) {
|
|
178
|
+
var str = String.fromCodePoint(cx);
|
|
179
|
+
var enc = JSON.stringify(str);
|
|
180
|
+
var dec = JSON.parse(enc);
|
|
181
|
+
assert(dec, str);
|
|
182
|
+
var obj = { [str]: str };
|
|
183
|
+
enc = JSON.stringify(obj);
|
|
184
|
+
dec = JSON.parse(enc);
|
|
185
|
+
assert(dec, obj);
|
|
186
|
+
obj = { [enc]: dec, [str]: obj };
|
|
187
|
+
var enc = JSON.stringify(obj);
|
|
188
|
+
dec = JSON.parse(enc);
|
|
189
|
+
if (!assert(dec, obj)) {
|
|
190
|
+
console.log(cx, str, cx.toString(16), enc, dec, obj);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
console.log(performance.now() - start_time);
|
|
195
|
+
}
|
|
175
196
|
function JSON_test() {
|
|
176
197
|
window.JSON0 = JSON0;
|
|
177
198
|
window.JSON = void 0;
|
|
178
199
|
delete modules.JSON;
|
|
179
200
|
modules.init("JSON", test2);
|
|
201
|
+
modules.init("JSON", test3);
|
|
180
202
|
window.JSON = JSON0;
|
|
181
203
|
}
|