mm_expand 1.5.3 → 1.5.4
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/index.js +5 -6
- package/package.json +2 -1
- package/test.js +5 -1
package/index.js
CHANGED
|
@@ -1320,10 +1320,10 @@ if (typeof($) === "undefined") {
|
|
|
1320
1320
|
|
|
1321
1321
|
/**
|
|
1322
1322
|
* @description 删除文件
|
|
1323
|
-
* @param {String}
|
|
1323
|
+
* @param {String} file 当前路径
|
|
1324
1324
|
*/
|
|
1325
|
-
String.prototype.delFile = function(
|
|
1326
|
-
unlink(this.fullname(
|
|
1325
|
+
String.prototype.delFile = function(file) {
|
|
1326
|
+
unlink(this.fullname(file), function(e) {});
|
|
1327
1327
|
};
|
|
1328
1328
|
|
|
1329
1329
|
/**
|
|
@@ -2275,15 +2275,14 @@ if (typeof($) === "undefined") {
|
|
|
2275
2275
|
* @description 加载文件
|
|
2276
2276
|
* @param {String} file 文件路径
|
|
2277
2277
|
* @param {String} data 编码方式
|
|
2278
|
-
* @param {Boolean} options 写出成功返回true, 失败返回false
|
|
2279
2278
|
* @return {Boolean} 保存成功返回true,否则返回false
|
|
2280
2279
|
*/
|
|
2281
|
-
File.prototype.save = function(file, data,
|
|
2280
|
+
File.prototype.save = function(file, data, encode) {
|
|
2282
2281
|
if (data) {
|
|
2283
2282
|
if (!encode) {
|
|
2284
2283
|
encode = "utf-8"
|
|
2285
2284
|
}
|
|
2286
|
-
return writeFileSync(file, encode);
|
|
2285
|
+
return writeFileSync(file, data, encode);
|
|
2287
2286
|
} else {
|
|
2288
2287
|
return false;
|
|
2289
2288
|
}
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -10,7 +10,11 @@ var num = 5;
|
|
|
10
10
|
// console.log(num.rand(1));
|
|
11
11
|
// console.log(num.rand(1));
|
|
12
12
|
// console.log(num.rand(1));
|
|
13
|
-
|
|
13
|
+
"./中文/的".addDir();
|
|
14
|
+
"./中文/test.json".saveJson({ name: "123" });
|
|
15
|
+
"./中文/test.json".delFile();
|
|
16
|
+
"./中文".delDir();
|
|
17
|
+
console.log()
|
|
14
18
|
|
|
15
19
|
// 随机一个上下浮动10的数值
|
|
16
20
|
console.log(num.range(10));
|