mm_expand 1.6.4 → 1.6.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.
Files changed (3) hide show
  1. package/index.js +12 -6
  2. package/package.json +1 -1
  3. package/test.js +1 -1
package/index.js CHANGED
@@ -28,7 +28,8 @@ const {
28
28
  join,
29
29
  dirname,
30
30
  basename,
31
- extname
31
+ extname,
32
+ resolve
32
33
  } = require('path');
33
34
  const {
34
35
  inspect
@@ -47,6 +48,7 @@ const Lang = require('./lang.js');
47
48
  * @type {String}
48
49
  */
49
50
  const slash = join('/');
51
+ const rootPath = resolve();
50
52
 
51
53
  /* == 基础函数 == */
52
54
  /**
@@ -536,6 +538,8 @@ if (typeof($) === "undefined") {
536
538
  },
537
539
  // 当前系统路径使用的斜杠
538
540
  slash: slash,
541
+ // 系统跟目录
542
+ rootPath, rootPath,
539
543
  // 运行根目录
540
544
  runPath: process.cwd() + slash,
541
545
  // 延迟
@@ -1265,11 +1269,13 @@ if (typeof($) === "undefined") {
1265
1269
  dir = $.runPath;
1266
1270
  }
1267
1271
  file = file.replace(/\//g, slash);
1268
- if (!file.startWith($.runPath)) {
1269
- if (file.startWith(slash)) {
1270
- file = join($.runPath, file);
1271
- } else {
1272
- file = join(dir, file);
1272
+ if (!file.startWith($.rootPath)) {
1273
+ if (!file.startWith($.runPath)) {
1274
+ if (file.startWith(slash)) {
1275
+ file = join($.rootPath, file);
1276
+ } else {
1277
+ file = join(dir, file);
1278
+ }
1273
1279
  }
1274
1280
  }
1275
1281
  if (!file.endsWith(slash)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "这是超级美眉原型函数拓展模块,更有利于对string、array、object的操作,避免出错,简化业务逻辑。",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  require('./index.js');
2
2
 
3
-
3
+ // console.log($.rootPath);
4
4
  console.log("./fast/log".fullname(__dirname));
5
5
  console.log("./fast/log".fullname());
6
6
  console.log("./fast/log/".fullname());