mingyang_text 2023.2.8 → 2023.5.18
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/text.js +29 -5
package/package.json
CHANGED
package/text.js
CHANGED
@@ -305,22 +305,46 @@ module.exports.do_KeyValue_Decode = func_KeyValue_Decode;
|
|
305
305
|
* @param {"源数据包"} args_Datas
|
306
306
|
* @param {"分割字符"} args_Split
|
307
307
|
* @param {"等于字符"} args_Equal
|
308
|
+
* @param {"是否编码"} args_EncodeUriComponent
|
309
|
+
* @param {"是否排序"} args_Sort
|
308
310
|
*/
|
309
|
-
function func_KeyValue_Encode(args_Datas, args_Split, args_Equal) {
|
311
|
+
function func_KeyValue_Encode(args_Datas, args_Split, args_Equal, args_EncodeUriComponent = true, args_Sort = false) {
|
310
312
|
|
311
313
|
let temp_Keys = Object.keys(args_Datas);
|
314
|
+
if (true == args_Sort) {
|
315
|
+
temp_Keys.sort();
|
316
|
+
}
|
317
|
+
|
312
318
|
let t_Lenth = temp_Keys.length;
|
313
319
|
if (t_Lenth == 0) {
|
314
320
|
return "";
|
315
321
|
}
|
316
322
|
|
323
|
+
let temp_Value = "";
|
324
|
+
let temp_Line = "";
|
317
325
|
let i = 0;
|
318
|
-
|
319
|
-
|
326
|
+
|
327
|
+
{
|
328
|
+
if (true == args_EncodeUriComponent) {
|
329
|
+
temp_Value = encodeURIComponent(args_Datas[temp_Keys[i]]);
|
330
|
+
}
|
331
|
+
else {
|
332
|
+
temp_Value = args_Datas[temp_Keys[i]];
|
333
|
+
}
|
334
|
+
temp_Line = encodeURIComponent(temp_Keys[i]) + args_Equal + temp_Value;
|
335
|
+
i++;
|
336
|
+
}
|
320
337
|
|
321
338
|
for (; i < t_Lenth; i++) {
|
322
339
|
temp_Line += args_Split;
|
323
|
-
|
340
|
+
|
341
|
+
if (true == args_EncodeUriComponent) {
|
342
|
+
temp_Value = encodeURIComponent(args_Datas[temp_Keys[i]]);
|
343
|
+
}
|
344
|
+
else {
|
345
|
+
temp_Value = args_Datas[temp_Keys[i]];
|
346
|
+
}
|
347
|
+
temp_Line += encodeURIComponent(temp_Keys[i]) + args_Equal + temp_Value;
|
324
348
|
}
|
325
349
|
|
326
350
|
return temp_Line;
|
@@ -428,7 +452,7 @@ module.exports.do_Base62Decode = func_Base62Decode;
|
|
428
452
|
* @param {原始字符串} args_Text
|
429
453
|
* @param {分隔符数组} args_DelimiterArray
|
430
454
|
*/
|
431
|
-
function func_Split(args_Text, args_DelimiterArray = [",", "-", "/", "|", "~", "*", "+"]) {
|
455
|
+
function func_Split(args_Text, args_DelimiterArray = [",", "-", "_", "/", "|", "~", "*", "+"]) {
|
432
456
|
let temp_Result = [args_Text];
|
433
457
|
for (let u = 0; u < args_DelimiterArray.length; u++) {
|
434
458
|
if (args_Text.indexOf(args_DelimiterArray[u]) > -1) {
|