utiller 1.0.291 → 1.0.292

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.
@@ -120,11 +120,13 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
120
120
  key: "findSpecificFolderByPath",
121
121
  value: function findSpecificFolderByPath(path, folderName) {
122
122
  var absolute = _path5["default"].resolve(path);
123
- var splited = absolute.split("/");
124
- while (!_fs["default"].existsSync("".concat(splited.join("/"), "/").concat(folderName)) && splited.length > 0) {
125
- splited.pop();
123
+ var parts = absolute.split(_path5["default"].sep);
124
+ while (parts.length) {
125
+ var joined = _path5["default"].join.apply(_path5["default"], (0, _toConsumableArray2["default"])(parts).concat([folderName]));
126
+ if (_fs["default"].existsSync(joined)) return joined;
127
+ parts.pop();
126
128
  }
127
- return "".concat(splited.join("/"), "/.idea");
129
+ return null;
128
130
  }
129
131
 
130
132
  /** {numpages, numrender, info, text, version} */
@@ -593,10 +595,10 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
593
595
  }, {
594
596
  key: "getNamesOfFolderChild",
595
597
  value: function getNamesOfFolderChild(path) {
596
- return _lodash["default"].filter(this.getChildPathByPath(path), function (each) {
597
- return each.isDirectory;
598
- }).map(function (path) {
599
- return path.dirName;
598
+ return this.getChildPathByPath(path).filter(function (p) {
599
+ return p.isDirectory;
600
+ }).map(function (p) {
601
+ return p.dirName;
600
602
  });
601
603
  }
602
604
 
@@ -650,7 +652,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
650
652
  }, {
651
653
  key: "isImageFile",
652
654
  value: function isImageFile(file) {
653
- return this.isOrEquals(file.extension, "svg", "png", "jpg", "jpeg");
655
+ return ["svg", "png", "jpg", "jpeg"].includes(file.extension);
654
656
  }
655
657
 
656
658
  /** 把內容都抹掉each 是 fileName, ex:index.js*/
@@ -1841,15 +1843,15 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1841
1843
  /**
1842
1844
  * from, destination
1843
1845
  *
1844
- * 讓file content清除後,在寫入資料, 避免destined file address改變*/
1846
+ * 讓file content清除後,在寫入資料, 避免to(destination) file address改變*/
1845
1847
  )
1846
1848
  }, {
1847
1849
  key: "rewriteFile2File",
1848
- value: function rewriteFile2File(from, destination) {
1850
+ value: function rewriteFile2File(from, to) {
1849
1851
  var content = this.getFileContextInRaw(from);
1850
- if (_lodash["default"].isEmpty(content)) throw new _index2["default"](9999, "".concat(from, " \u5167\u5BB9\u70BA\u7A7A\u503C, ***rewrite\u529F\u80FD\u6703\u907F\u514D\u7A7A\u503C\u8986\u84CB, \u9019\u662F\u4E00\u500B\u8A2D\u8A08"));
1851
- this.appendFile(destination, content, true, true);
1852
- this.appendInfo("rewrite from:".concat(from, " => dest:").concat(destination, " succeed"));
1852
+ if (!content.trim()) throw new _index2["default"](9999, "".concat(from, " \u70BA\u7A7A\uFF0C\u907F\u514D\u8986\u84CB"));
1853
+ this.appendFile(to, content, true, true);
1854
+ this.appendInfo("rewrite from:".concat(from, " => to:").concat(to, " \u6210\u529F"));
1853
1855
  }
1854
1856
 
1855
1857
  /** 取得file第一行statement */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utiller",
3
- "version": "1.0.291",
3
+ "version": "1.0.292",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "configerer": "^1.0.11",
14
- "utiller": "^1.0.290",
14
+ "utiller": "^1.0.291",
15
15
  "linepayer": "^1.0.4",
16
16
  "databazer": "^1.0.12",
17
17
  "lodash": "^4.17.20",