mm_expand 2.3.5 → 2.3.6
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/lib/file.js +2 -2
- package/lib/ret.js +31 -31
- package/lib/string.js +2 -2
- package/package.json +2 -2
package/lib/file.js
CHANGED
|
@@ -417,7 +417,7 @@ async function eachDirAsync(list, dir, keyword) {
|
|
|
417
417
|
var subDirs = [];
|
|
418
418
|
for (var i = 0; i < items.length; i++) {
|
|
419
419
|
var item = items[i];
|
|
420
|
-
if (item.
|
|
420
|
+
if (item.isDir()) {
|
|
421
421
|
var full_path = join(dir, item.name);
|
|
422
422
|
if (!keyword || item.name.has(keyword)) {
|
|
423
423
|
list.push(full_path);
|
|
@@ -621,7 +621,7 @@ String.prototype.copyDir = function (file, func) {
|
|
|
621
621
|
String.prototype.isDir = function () {
|
|
622
622
|
var bl = false;
|
|
623
623
|
try {
|
|
624
|
-
bl = statSync(this + '').
|
|
624
|
+
bl = statSync(this + '').isDir();
|
|
625
625
|
} catch {
|
|
626
626
|
// $.log.error("非路径");
|
|
627
627
|
}
|
package/lib/ret.js
CHANGED
|
@@ -85,37 +85,37 @@ Ret.prototype._getMessage = function (code) {
|
|
|
85
85
|
* @param {boolean} diy 是否自定义错误提示
|
|
86
86
|
* @returns {object} JSON-RPC 2.0响应格式
|
|
87
87
|
*/
|
|
88
|
-
Ret.prototype._toJsonRPC = function (result, error, id, _diy = true) {
|
|
89
|
-
const ret = {
|
|
90
|
-
};
|
|
91
|
-
if (id) {
|
|
92
|
-
ret.id = id;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (result) {
|
|
96
|
-
ret.result = result;
|
|
97
|
-
}
|
|
98
|
-
else if (error) {
|
|
99
|
-
if (!error.code) {
|
|
100
|
-
error.code = this.config.error_code;
|
|
101
|
-
}
|
|
102
|
-
var diy = _diy || this.config.message_diy;
|
|
103
|
-
if (!diy) {
|
|
104
|
-
error.message = this._getMessage(error.code) || error.message;
|
|
105
|
-
}
|
|
106
|
-
else if (!error.message) {
|
|
107
|
-
error.message = this._getMessage(error.code);
|
|
108
|
-
}
|
|
109
|
-
ret.error = error;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
ret.error = {
|
|
113
|
-
code: this.config.error_code,
|
|
114
|
-
message: this._getMessage(this.config.error_code)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (this.config.fs) {
|
|
118
|
-
ret.fs = this.config.fs;
|
|
88
|
+
Ret.prototype._toJsonRPC = function (result, error, id, _diy = true) {
|
|
89
|
+
const ret = {
|
|
90
|
+
};
|
|
91
|
+
if (id) {
|
|
92
|
+
ret.id = id;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (result) {
|
|
96
|
+
ret.result = result;
|
|
97
|
+
}
|
|
98
|
+
else if (error) {
|
|
99
|
+
if (!error.code) {
|
|
100
|
+
error.code = this.config.error_code;
|
|
101
|
+
}
|
|
102
|
+
var diy = _diy || this.config.message_diy;
|
|
103
|
+
if (!diy) {
|
|
104
|
+
error.message = this._getMessage(error.code) || error.message;
|
|
105
|
+
}
|
|
106
|
+
else if (!error.message) {
|
|
107
|
+
error.message = this._getMessage(error.code);
|
|
108
|
+
}
|
|
109
|
+
ret.error = error;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
ret.error = {
|
|
113
|
+
code: this.config.error_code,
|
|
114
|
+
message: this._getMessage(this.config.error_code)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (this.config.fs) {
|
|
118
|
+
ret.fs = this.config.fs;
|
|
119
119
|
}
|
|
120
120
|
return ret;
|
|
121
121
|
};
|
package/lib/string.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const json5 = require('json5');
|
|
5
5
|
const pinyin = require('pinyinlite');
|
|
6
|
-
const { createHash, createCipheriv,
|
|
6
|
+
const { createHash, createCipheriv, createDecipheriv } = require('crypto');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* form-data转对象
|
|
@@ -77,7 +77,7 @@ String.prototype.aesDecode = function (key, iv) {
|
|
|
77
77
|
const chunks = [];
|
|
78
78
|
|
|
79
79
|
try {
|
|
80
|
-
let decipher =
|
|
80
|
+
let decipher = createDecipheriv ('aes-256-ecb', key, _iv);
|
|
81
81
|
decipher.setAutoPadding(true);
|
|
82
82
|
chunks.push(decipher.update(this + '', 'base64', encoding));
|
|
83
83
|
chunks.push(decipher.final(encoding));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_expand",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.6",
|
|
4
4
|
"description": "超级美眉原型函数扩展模块 - 增强的字符串、数组、对象、日期操作,具备错误预防功能并简化业务逻辑",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"eslint": "^10.6.0",
|
|
49
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
49
|
+
"eslint-plugin-jsdoc": "^63.0.10",
|
|
50
50
|
"mm_eslint": "^1.7.5"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|