@bemoje/path 0.1.8 → 1.0.0

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 (105) hide show
  1. package/index.d.ts +121 -0
  2. package/index.mjs +153 -0
  3. package/package.json +22 -18
  4. package/LICENSE +0 -21
  5. package/README.md +0 -34
  6. package/cjs/index.d.ts +0 -25
  7. package/cjs/index.d.ts.map +0 -1
  8. package/cjs/index.js +0 -28
  9. package/cjs/index.js.map +0 -1
  10. package/cjs/lib/createFileExtensionFilter.d.ts +0 -14
  11. package/cjs/lib/createFileExtensionFilter.d.ts.map +0 -1
  12. package/cjs/lib/createFileExtensionFilter.js +0 -27
  13. package/cjs/lib/createFileExtensionFilter.js.map +0 -1
  14. package/cjs/lib/cwdpath.d.ts +0 -13
  15. package/cjs/lib/cwdpath.d.ts.map +0 -1
  16. package/cjs/lib/cwdpath.js +0 -21
  17. package/cjs/lib/cwdpath.js.map +0 -1
  18. package/cjs/lib/getAppDataPath.d.ts +0 -5
  19. package/cjs/lib/getAppDataPath.d.ts.map +0 -1
  20. package/cjs/lib/getAppDataPath.js +0 -37
  21. package/cjs/lib/getAppDataPath.js.map +0 -1
  22. package/cjs/lib/getDiskDrivesWindows.d.ts +0 -10
  23. package/cjs/lib/getDiskDrivesWindows.d.ts.map +0 -1
  24. package/cjs/lib/getDiskDrivesWindows.js +0 -24
  25. package/cjs/lib/getDiskDrivesWindows.js.map +0 -1
  26. package/cjs/lib/getDownloadsDirectory.d.ts +0 -12
  27. package/cjs/lib/getDownloadsDirectory.d.ts.map +0 -1
  28. package/cjs/lib/getDownloadsDirectory.js +0 -52
  29. package/cjs/lib/getDownloadsDirectory.js.map +0 -1
  30. package/cjs/lib/getHomeDirectory.d.ts +0 -5
  31. package/cjs/lib/getHomeDirectory.d.ts.map +0 -1
  32. package/cjs/lib/getHomeDirectory.js +0 -16
  33. package/cjs/lib/getHomeDirectory.js.map +0 -1
  34. package/cjs/lib/getTempDataPath.d.ts +0 -7
  35. package/cjs/lib/getTempDataPath.d.ts.map +0 -1
  36. package/cjs/lib/getTempDataPath.js +0 -18
  37. package/cjs/lib/getTempDataPath.js.map +0 -1
  38. package/cjs/lib/isValidFileExtension.d.ts +0 -7
  39. package/cjs/lib/isValidFileExtension.d.ts.map +0 -1
  40. package/cjs/lib/isValidFileExtension.js +0 -13
  41. package/cjs/lib/isValidFileExtension.js.map +0 -1
  42. package/cjs/lib/isValidWindowsPath.d.ts +0 -10
  43. package/cjs/lib/isValidWindowsPath.d.ts.map +0 -1
  44. package/cjs/lib/isValidWindowsPath.js +0 -26
  45. package/cjs/lib/isValidWindowsPath.js.map +0 -1
  46. package/cjs/lib/normalizeFileExtension.d.ts +0 -23
  47. package/cjs/lib/normalizeFileExtension.d.ts.map +0 -1
  48. package/cjs/lib/normalizeFileExtension.js +0 -34
  49. package/cjs/lib/normalizeFileExtension.js.map +0 -1
  50. package/cjs/lib/pathAbsoluteToRelativeCwd.d.ts +0 -14
  51. package/cjs/lib/pathAbsoluteToRelativeCwd.d.ts.map +0 -1
  52. package/cjs/lib/pathAbsoluteToRelativeCwd.js +0 -28
  53. package/cjs/lib/pathAbsoluteToRelativeCwd.js.map +0 -1
  54. package/cjs/lib/pathBasename.d.ts +0 -19
  55. package/cjs/lib/pathBasename.d.ts.map +0 -1
  56. package/cjs/lib/pathBasename.js +0 -43
  57. package/cjs/lib/pathBasename.js.map +0 -1
  58. package/cjs/lib/pathDirname.d.ts +0 -19
  59. package/cjs/lib/pathDirname.d.ts.map +0 -1
  60. package/cjs/lib/pathDirname.js +0 -48
  61. package/cjs/lib/pathDirname.js.map +0 -1
  62. package/cjs/lib/pathExtname.d.ts +0 -14
  63. package/cjs/lib/pathExtname.d.ts.map +0 -1
  64. package/cjs/lib/pathExtname.js +0 -39
  65. package/cjs/lib/pathExtname.js.map +0 -1
  66. package/cjs/lib/pathGetSeparator.d.ts +0 -8
  67. package/cjs/lib/pathGetSeparator.d.ts.map +0 -1
  68. package/cjs/lib/pathGetSeparator.js +0 -19
  69. package/cjs/lib/pathGetSeparator.js.map +0 -1
  70. package/cjs/lib/pathIsAbsolute.d.ts +0 -19
  71. package/cjs/lib/pathIsAbsolute.d.ts.map +0 -1
  72. package/cjs/lib/pathIsAbsolute.js +0 -30
  73. package/cjs/lib/pathIsAbsolute.js.map +0 -1
  74. package/cjs/lib/pathIsDotFile.d.ts +0 -7
  75. package/cjs/lib/pathIsDotFile.d.ts.map +0 -1
  76. package/cjs/lib/pathIsDotFile.js +0 -13
  77. package/cjs/lib/pathIsDotFile.js.map +0 -1
  78. package/cjs/lib/pathIsRelative.d.ts +0 -7
  79. package/cjs/lib/pathIsRelative.d.ts.map +0 -1
  80. package/cjs/lib/pathIsRelative.js +0 -13
  81. package/cjs/lib/pathIsRelative.js.map +0 -1
  82. package/cjs/lib/pathIsRelativePosix.d.ts +0 -7
  83. package/cjs/lib/pathIsRelativePosix.d.ts.map +0 -1
  84. package/cjs/lib/pathIsRelativePosix.js +0 -13
  85. package/cjs/lib/pathIsRelativePosix.js.map +0 -1
  86. package/cjs/lib/pathIsRelativeWindows.d.ts +0 -7
  87. package/cjs/lib/pathIsRelativeWindows.d.ts.map +0 -1
  88. package/cjs/lib/pathIsRelativeWindows.js +0 -14
  89. package/cjs/lib/pathIsRelativeWindows.js.map +0 -1
  90. package/cjs/lib/pathIsUnc.d.ts +0 -7
  91. package/cjs/lib/pathIsUnc.d.ts.map +0 -1
  92. package/cjs/lib/pathIsUnc.js +0 -13
  93. package/cjs/lib/pathIsUnc.js.map +0 -1
  94. package/cjs/lib/pathJoin.d.ts +0 -5
  95. package/cjs/lib/pathJoin.d.ts.map +0 -1
  96. package/cjs/lib/pathJoin.js +0 -10
  97. package/cjs/lib/pathJoin.js.map +0 -1
  98. package/cjs/lib/pathRoot.d.ts +0 -19
  99. package/cjs/lib/pathRoot.d.ts.map +0 -1
  100. package/cjs/lib/pathRoot.js +0 -41
  101. package/cjs/lib/pathRoot.js.map +0 -1
  102. package/cjs/lib/toPosixPath.d.ts +0 -5
  103. package/cjs/lib/toPosixPath.d.ts.map +0 -1
  104. package/cjs/lib/toPosixPath.js +0 -9
  105. package/cjs/lib/toPosixPath.js.map +0 -1
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDownloadsDirectory = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
6
- const path_1 = tslib_1.__importDefault(require("path"));
7
- const child_process_1 = require("child_process");
8
- const getHomeDirectory_1 = require("./getHomeDirectory");
9
- const os_1 = require("@bemoje/os");
10
- const fs_1 = require("fs");
11
- const osx = () => `${process.env.HOME}/Downloads`;
12
- const linux = () => {
13
- let dir;
14
- try {
15
- dir = (0, child_process_1.execSync)('xdg-user-dir DOWNLOAD', { encoding: 'utf8' }).trim();
16
- }
17
- catch {
18
- dir = undefined;
19
- }
20
- if (dir && dir !== process.env.HOME)
21
- return dir;
22
- const homeDownloads = `${process.env.HOME}/Downloads`;
23
- try {
24
- const stat = (0, fs_1.statSync)(homeDownloads);
25
- if (stat)
26
- return homeDownloads;
27
- }
28
- catch {
29
- // Ignored
30
- }
31
- return '/tmp/';
32
- };
33
- const windows = () => {
34
- const result = path_1.default.join((0, getHomeDirectory_1.getHomeDirectory)(), 'Downloads');
35
- if (!fs_extra_1.default.existsSync(result))
36
- throw new Error('Downloads directory does not exist');
37
- return result;
38
- };
39
- /**
40
- * Returns the downloads directory of the current user.
41
- */
42
- function getDownloadsDirectory() {
43
- const os = (0, os_1.getOS)();
44
- if (os === 'unknown')
45
- throw new Error('Unknown OS');
46
- return os === 'linux' ? linux() : os === 'windows' ? windows() : osx();
47
- }
48
- exports.getDownloadsDirectory = getDownloadsDirectory;
49
- getDownloadsDirectory.osx = osx;
50
- getDownloadsDirectory.linux = linux;
51
- getDownloadsDirectory.windows = windows;
52
- //# sourceMappingURL=getDownloadsDirectory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDownloadsDirectory.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getDownloadsDirectory.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AACzB,wDAAuB;AACvB,iDAAwC;AACxC,yDAAqD;AACrD,mCAAkC;AAClC,2BAA6B;AAI7B,MAAM,GAAG,GAAuB,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,YAAY,CAAA;AAErE,MAAM,KAAK,GAAuB,GAAG,EAAE;IACrC,IAAI,GAAuB,CAAA;IAC3B,IAAI;QACF,GAAG,GAAG,IAAA,wBAAQ,EAAC,uBAAuB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;KACrE;IAAC,MAAM;QACN,GAAG,GAAG,SAAS,CAAA;KAChB;IACD,IAAI,GAAG,IAAI,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,GAAG,CAAA;IAE/C,MAAM,aAAa,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,YAAY,CAAA;IACrD,IAAI;QACF,MAAM,IAAI,GAAG,IAAA,aAAQ,EAAC,aAAa,CAAC,CAAA;QACpC,IAAI,IAAI;YAAE,OAAO,aAAa,CAAA;KAC/B;IAAC,MAAM;QACN,UAAU;KACX;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,OAAO,GAAuB,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,mCAAgB,GAAE,EAAE,WAAW,CAAC,CAAA;IACzD,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACjF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,MAAM,EAAE,GAAG,IAAA,UAAK,GAAE,CAAA;IAClB,IAAI,EAAE,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IACnD,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;AACxE,CAAC;AAJD,sDAIC;AAED,qBAAqB,CAAC,GAAG,GAAG,GAAG,CAAA;AAC/B,qBAAqB,CAAC,KAAK,GAAG,KAAK,CAAA;AACnC,qBAAqB,CAAC,OAAO,GAAG,OAAO,CAAA"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Returns the home directory of the current user.
3
- */
4
- export declare function getHomeDirectory(): string;
5
- //# sourceMappingURL=getHomeDirectory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHomeDirectory.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getHomeDirectory.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHomeDirectory = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- /**
7
- * Returns the home directory of the current user.
8
- */
9
- function getHomeDirectory() {
10
- const home = process.env['HOME'] || process.env['USERPROFILE'];
11
- if (!home)
12
- throw new Error('Home directory not found');
13
- return path_1.default.resolve(home);
14
- }
15
- exports.getHomeDirectory = getHomeDirectory;
16
- //# sourceMappingURL=getHomeDirectory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHomeDirectory.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getHomeDirectory.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AAEvB;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAC9D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACtD,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC;AAJD,4CAIC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Returns a path to the os tmpdir location.
3
- *
4
- * @param paths - The paths to join to the os tmpdir location.
5
- */
6
- export declare function getTempDataPath(...paths: string[]): string;
7
- //# sourceMappingURL=getTempDataPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTempDataPath.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getTempDataPath.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTempDataPath = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
6
- const os_1 = tslib_1.__importDefault(require("os"));
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- /**
9
- * Returns a path to the os tmpdir location.
10
- *
11
- * @param paths - The paths to join to the os tmpdir location.
12
- */
13
- function getTempDataPath(...paths) {
14
- return path_1.default.join(tempdir, ...paths);
15
- }
16
- exports.getTempDataPath = getTempDataPath;
17
- const tempdir = fs_extra_1.default.realpathSync(os_1.default.tmpdir());
18
- //# sourceMappingURL=getTempDataPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTempDataPath.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getTempDataPath.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AACzB,oDAAmB;AACnB,wDAAuB;AAEvB;;;;GAIG;AACH,SAAgB,eAAe,CAAC,GAAG,KAAe;IAChD,OAAO,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAA;AACrC,CAAC;AAFD,0CAEC;AAED,MAAM,OAAO,GAAG,kBAAE,CAAC,YAAY,CAAC,YAAE,CAAC,MAAM,EAAE,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Check if a file extension is valid.
3
- *
4
- * @param ext - The file extension to check.
5
- */
6
- export declare function isValidFileExtension(ext: string): boolean;
7
- //# sourceMappingURL=isValidFileExtension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidFileExtension.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/isValidFileExtension.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidFileExtension = void 0;
4
- /**
5
- * Check if a file extension is valid.
6
- *
7
- * @param ext - The file extension to check.
8
- */
9
- function isValidFileExtension(ext) {
10
- return !!ext && ext !== '.' && !/[<>"|?*:]/.test(ext);
11
- }
12
- exports.isValidFileExtension = isValidFileExtension;
13
- //# sourceMappingURL=isValidFileExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidFileExtension.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/isValidFileExtension.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACvD,CAAC;AAFD,oDAEC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Check whether a provided windows filesystem path string is valid according to:
3
- * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
4
- * @param path The path to validate.
5
- * @throws If the path is invalid and the `assert` option is true.
6
- */
7
- export declare function isValidWindowsPath(path: string, options?: {
8
- extendedMaxLength?: boolean;
9
- }): boolean;
10
- //# sourceMappingURL=isValidWindowsPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidWindowsPath.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/isValidWindowsPath.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CASnG"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidWindowsPath = void 0;
4
- /**
5
- * Check whether a provided windows filesystem path string is valid according to:
6
- * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
7
- * @param path The path to validate.
8
- * @throws If the path is invalid and the `assert` option is true.
9
- */
10
- function isValidWindowsPath(path, options) {
11
- if (path.length === 0)
12
- return false;
13
- if (path.indexOf('/') !== -1 && path.indexOf('\\') !== -1)
14
- return false;
15
- const maxLength = (options && options.extendedMaxLength ? 32767 : 260) - 12;
16
- if (path.length > maxLength)
17
- return false;
18
- const noDriveLetter = /^\w:(\\|\/)/g.test(path) ? path.substring(2) : path;
19
- if (/[<>"|?*:]/g.test(noDriveLetter))
20
- return false;
21
- if (/(\\|\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\|\/)|$)/g.test(path))
22
- return false;
23
- return true;
24
- }
25
- exports.isValidWindowsPath = isValidWindowsPath;
26
- //# sourceMappingURL=isValidWindowsPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidWindowsPath.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/isValidWindowsPath.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,IAAY,EAAE,OAAyC;IACxF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACnC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACvE,MAAM,SAAS,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;IAC3E,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS;QAAE,OAAO,KAAK,CAAA;IACzC,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1E,IAAI,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;QAAE,OAAO,KAAK,CAAA;IAClD,IAAI,wDAAwD,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IACrF,OAAO,IAAI,CAAA;AACb,CAAC;AATD,gDASC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Normalize a file extension to the form: .[ext]
3
- * Anything before the last "." is not returned.
4
- * @returns The normalized file extension.
5
- * @throws If the extension contains illegal characters or is equal to '.'
6
- * @param ext file extension
7
- * @example ```ts
8
- * normalizeFileExtension('jpg');
9
- * //=> '.jpg'
10
- * normalizeFileExtension('.jpg');
11
- * //=> '.jpg'
12
- * normalizeFileExtension('..jpg');
13
- * //=> '.jpg'
14
- * normalizeFileExtension('');
15
- * //=> ''
16
- * normalizeFileExtension('.');
17
- * //=> ''
18
- * normalizeFileExtension('jpg|png');
19
- * //=> Error
20
- * ```
21
- */
22
- export declare function normalizeFileExtension(ext: string): string;
23
- //# sourceMappingURL=normalizeFileExtension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeFileExtension.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/normalizeFileExtension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK1D"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeFileExtension = void 0;
4
- /**
5
- * Normalize a file extension to the form: .[ext]
6
- * Anything before the last "." is not returned.
7
- * @returns The normalized file extension.
8
- * @throws If the extension contains illegal characters or is equal to '.'
9
- * @param ext file extension
10
- * @example ```ts
11
- * normalizeFileExtension('jpg');
12
- * //=> '.jpg'
13
- * normalizeFileExtension('.jpg');
14
- * //=> '.jpg'
15
- * normalizeFileExtension('..jpg');
16
- * //=> '.jpg'
17
- * normalizeFileExtension('');
18
- * //=> ''
19
- * normalizeFileExtension('.');
20
- * //=> ''
21
- * normalizeFileExtension('jpg|png');
22
- * //=> Error
23
- * ```
24
- */
25
- function normalizeFileExtension(ext) {
26
- if (!ext || ext === '.')
27
- return '';
28
- ext = ext.toLowerCase();
29
- if (!ext.startsWith('.'))
30
- ext = '.' + ext;
31
- return ext.substring(ext.lastIndexOf('.'));
32
- }
33
- exports.normalizeFileExtension = normalizeFileExtension;
34
- //# sourceMappingURL=normalizeFileExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeFileExtension.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/normalizeFileExtension.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG;QAAE,OAAO,EAAE,CAAA;IAClC,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IACvB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IACzC,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;AAC5C,CAAC;AALD,wDAKC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * If the filepath is somewhere in the current working directory, it can be converted into a relative path.
3
- * @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,
4
- * replaces all backslashes with forward slashes, and removes any leading forward slashes.
5
- * @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.
6
- * @returns The relative path.
7
- * @param absolute the absolute filepath to convert.
8
- * @example ```ts
9
- * pathAbsoluteToRelativeCwd(__filename)
10
- * //=> 'src/pathAbsoluteToRelativeCwd.ts'
11
- * ```
12
- */
13
- export declare function pathAbsoluteToRelativeCwd(absolute: string, workingDirectory?: string): string;
14
- //# sourceMappingURL=pathAbsoluteToRelativeCwd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathAbsoluteToRelativeCwd.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathAbsoluteToRelativeCwd.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,SAAgB,GAAG,MAAM,CAQpG"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathAbsoluteToRelativeCwd = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- /**
7
- * If the filepath is somewhere in the current working directory, it can be converted into a relative path.
8
- * @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,
9
- * replaces all backslashes with forward slashes, and removes any leading forward slashes.
10
- * @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.
11
- * @returns The relative path.
12
- * @param absolute the absolute filepath to convert.
13
- * @example ```ts
14
- * pathAbsoluteToRelativeCwd(__filename)
15
- * //=> 'src/pathAbsoluteToRelativeCwd.ts'
16
- * ```
17
- */
18
- function pathAbsoluteToRelativeCwd(absolute, workingDirectory = process.cwd()) {
19
- absolute = path_1.default.normalize(absolute);
20
- if (absolute === workingDirectory)
21
- return './';
22
- return absolute.replace(new RegExp(regexEscapeString(path_1.default.normalize(workingDirectory) + path_1.default.sep), 'i'), '');
23
- function regexEscapeString(str) {
24
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
25
- }
26
- }
27
- exports.pathAbsoluteToRelativeCwd = pathAbsoluteToRelativeCwd;
28
- //# sourceMappingURL=pathAbsoluteToRelativeCwd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathAbsoluteToRelativeCwd.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathAbsoluteToRelativeCwd.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AAEvB;;;;;;;;;;;GAWG;AACH,SAAgB,yBAAyB,CAAC,QAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;IAC1F,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACnC,IAAI,QAAQ,KAAK,gBAAgB;QAAE,OAAO,IAAI,CAAA;IAC9C,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,iBAAiB,CAAC,cAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,cAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;IAE5G,SAAS,iBAAiB,CAAC,GAAW;QACpC,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA,CAAC,oCAAoC;IACxF,CAAC;AACH,CAAC;AARD,8DAQC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Identical to @see path.basename, but faster.
3
- *
4
- * @param filepath The path to evaluate.
5
- */
6
- export declare const pathBasename: typeof pathBasenameWindows;
7
- /**
8
- * Identical to @see path.posix.basename, but faster.
9
- *
10
- * @param filepath The path to evaluate.
11
- */
12
- export declare function pathBasenamePosix(fspath: string): string;
13
- /**
14
- * Identical to @see path.win32.basename, but faster.
15
- *
16
- * @param filepath The path to evaluate.
17
- */
18
- export declare function pathBasenameWindows(fspath: string): string;
19
- //# sourceMappingURL=pathBasename.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathBasename.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathBasename.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,YAAY,4BAAwD,CAAA;AAEjF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG1D"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathBasenameWindows = exports.pathBasenamePosix = exports.pathBasename = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const os_1 = require("@bemoje/os");
7
- /**
8
- * Identical to @see path.basename, but faster.
9
- *
10
- * @param filepath The path to evaluate.
11
- */
12
- exports.pathBasename = (0, os_1.isWindows)() ? pathBasenameWindows : pathBasenamePosix;
13
- /**
14
- * Identical to @see path.posix.basename, but faster.
15
- *
16
- * @param filepath The path to evaluate.
17
- */
18
- function pathBasenamePosix(fspath) {
19
- if (/^[a-z.]/i.test(fspath) || /\\/.test(fspath) || fspath.startsWith('.')) {
20
- return path_1.default.posix.basename(fspath);
21
- }
22
- return _getResult(fspath);
23
- }
24
- exports.pathBasenamePosix = pathBasenamePosix;
25
- /**
26
- * Identical to @see path.win32.basename, but faster.
27
- *
28
- * @param filepath The path to evaluate.
29
- */
30
- function pathBasenameWindows(fspath) {
31
- if (/^[a-z.]/i.test(fspath))
32
- return path_1.default.win32.basename(fspath);
33
- return _getResult(fspath);
34
- }
35
- exports.pathBasenameWindows = pathBasenameWindows;
36
- // helper function
37
- function _getResult(fspath) {
38
- const matches = /[\\/]([^\\/]+)[\\/]?$/.exec(fspath);
39
- if (!matches)
40
- return '';
41
- return matches[1];
42
- }
43
- //# sourceMappingURL=pathBasename.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathBasename.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathBasename.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AACvB,mCAAsC;AAEtC;;;;GAIG;AACU,QAAA,YAAY,GAAG,IAAA,cAAS,GAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAA;AAEjF;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC1E,OAAO,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;KACnC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AALD,8CAKC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,MAAc;IAChD,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC/D,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AAHD,kDAGC;AAED,kBAAkB;AAClB,SAAS,UAAU,CAAC,MAAc;IAChC,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAA;IACvB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Identical to @see path.dirname, but faster.
3
- *
4
- * @param filepath The path to evaluate.
5
- */
6
- export declare const pathDirname: typeof pathDirnameWindows;
7
- /**
8
- * Identical to @see path.posix.dirname, but faster.
9
- *
10
- * @param filepath The path to evaluate.
11
- */
12
- export declare function pathDirnamePosix(fspath: string): string;
13
- /**
14
- * Identical to @see path.win32.dirname, but faster.
15
- *
16
- * @param filepath The path to evaluate.
17
- */
18
- export declare function pathDirnameWindows(fspath: string): string;
19
- //# sourceMappingURL=pathDirname.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathDirname.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathDirname.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,WAAW,2BAAsD,CAAA;AAE9E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGzD"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathDirnameWindows = exports.pathDirnamePosix = exports.pathDirname = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const os_1 = require("@bemoje/os");
7
- const pathGetSeparator_1 = require("./pathGetSeparator");
8
- /**
9
- * Identical to @see path.dirname, but faster.
10
- *
11
- * @param filepath The path to evaluate.
12
- */
13
- exports.pathDirname = (0, os_1.isWindows)() ? pathDirnameWindows : pathDirnamePosix;
14
- /**
15
- * Identical to @see path.posix.dirname, but faster.
16
- *
17
- * @param filepath The path to evaluate.
18
- */
19
- function pathDirnamePosix(fspath) {
20
- if (!fspath || /^[a-z.]/i.test(fspath) || /\\/.test(fspath) || /^[\\/][\\/]/.test(fspath)) {
21
- return path_1.default.posix.dirname(fspath);
22
- }
23
- return _getResult(fspath);
24
- }
25
- exports.pathDirnamePosix = pathDirnamePosix;
26
- /**
27
- * Identical to @see path.win32.dirname, but faster.
28
- *
29
- * @param filepath The path to evaluate.
30
- */
31
- function pathDirnameWindows(fspath) {
32
- if (!fspath || /^[\\/][\\/]/.test(fspath) || /^[a-z.]/i.test(fspath))
33
- return path_1.default.win32.dirname(fspath);
34
- return _getResult(fspath);
35
- }
36
- exports.pathDirnameWindows = pathDirnameWindows;
37
- // helper function
38
- function _getResult(fspath) {
39
- const result = fspath.replace(/[\\/]$/, '').replace(/[\\/][^\\/]+$/, '');
40
- if (result.length > 2)
41
- return result;
42
- if (!result)
43
- return (0, pathGetSeparator_1.pathGetSeparator)(fspath);
44
- if (/^[a-z]:$/i.test(result) && !/^[a-z]:$/i.test(fspath))
45
- return result + (0, pathGetSeparator_1.pathGetSeparator)(fspath);
46
- return result;
47
- }
48
- //# sourceMappingURL=pathDirname.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathDirname.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathDirname.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AACvB,mCAAsC;AACtC,yDAAqD;AAErD;;;;GAIG;AACU,QAAA,WAAW,GAAG,IAAA,cAAS,GAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAA;AAE9E;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACzF,OAAO,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KAClC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AALD,4CAKC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACvG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AAHD,gDAGC;AAED,kBAAkB;AAClB,SAAS,UAAU,CAAC,MAAc;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;IACxE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAA;IACpC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAA,mCAAgB,EAAC,MAAM,CAAC,CAAA;IAC5C,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,GAAG,IAAA,mCAAgB,EAAC,MAAM,CAAC,CAAA;IACnG,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,14 +0,0 @@
1
- export declare const pathExtname: typeof pathExtnameWindows;
2
- /**
3
- * Identical to @see path.win32.extname, but faster.
4
- *
5
- * @param filepath The path to evaluate.
6
- */
7
- export declare function pathExtnamePosix(fspath: string): string;
8
- /**
9
- * Identical to @see path.win32.extname, but faster.
10
- *
11
- * @param filepath The path to evaluate.
12
- */
13
- export declare function pathExtnameWindows(fspath: string): string;
14
- //# sourceMappingURL=pathExtname.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathExtname.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathExtname.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,2BAAsD,CAAA;AAE9E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKzD"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathExtnameWindows = exports.pathExtnamePosix = exports.pathExtname = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const os_1 = require("@bemoje/os");
7
- exports.pathExtname = (0, os_1.isWindows)() ? pathExtnameWindows : pathExtnamePosix;
8
- /**
9
- * Identical to @see path.win32.extname, but faster.
10
- *
11
- * @param filepath The path to evaluate.
12
- */
13
- function pathExtnamePosix(fspath) {
14
- if (/\.$/.test(fspath)) {
15
- return path_1.default.posix.extname(fspath);
16
- }
17
- return _getResult(fspath);
18
- }
19
- exports.pathExtnamePosix = pathExtnamePosix;
20
- /**
21
- * Identical to @see path.win32.extname, but faster.
22
- *
23
- * @param filepath The path to evaluate.
24
- */
25
- function pathExtnameWindows(fspath) {
26
- if (/\.$/.test(fspath)) {
27
- return path_1.default.win32.extname(fspath);
28
- }
29
- return _getResult(fspath);
30
- }
31
- exports.pathExtnameWindows = pathExtnameWindows;
32
- // helper function
33
- function _getResult(fspath) {
34
- const matches = /[^\\/]+(\.[^\\/.]+)$/.exec(fspath);
35
- if (!matches)
36
- return '';
37
- return matches[1] || matches[2] || '';
38
- }
39
- //# sourceMappingURL=pathExtname.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathExtname.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathExtname.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AACvB,mCAAsC;AAEzB,QAAA,WAAW,GAAG,IAAA,cAAS,GAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAA;AAE9E;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KAClC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AALD,4CAKC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KAClC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AALD,gDAKC;AAED,kBAAkB;AAClB,SAAS,UAAU,CAAC,MAAc;IAChC,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAA;IACvB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACvC,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns the first forward- or back-slash found in the given path.
3
- * If no slash is found, returns the platform-specific path separator.
4
- *
5
- * @param filepath The path to evaluate.
6
- */
7
- export declare function pathGetSeparator(filepath: string): string;
8
- //# sourceMappingURL=pathGetSeparator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathGetSeparator.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathGetSeparator.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathGetSeparator = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- /**
7
- * Returns the first forward- or back-slash found in the given path.
8
- * If no slash is found, returns the platform-specific path separator.
9
- *
10
- * @param filepath The path to evaluate.
11
- */
12
- function pathGetSeparator(filepath) {
13
- const match = filepath.match(/[\\/]/);
14
- if (!match)
15
- return path_1.default.sep;
16
- return match[0];
17
- }
18
- exports.pathGetSeparator = pathGetSeparator;
19
- //# sourceMappingURL=pathGetSeparator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathGetSeparator.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathGetSeparator.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AAEvB;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrC,IAAI,CAAC,KAAK;QAAE,OAAO,cAAI,CAAC,GAAG,CAAA;IAC3B,OAAO,KAAK,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAJD,4CAIC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Determines if a given filepath is an absolute path.
3
- * @param filepath - The filepath to evaluate.
4
- * @returns A boolean indicating whether the filepath is an absolute path in Windows.
5
- */
6
- export declare const pathIsAbsolute: (filepath: string) => boolean;
7
- /**
8
- * Determines if a given filepath is an absolute path in POSIX.
9
- * @param filepath - The filepath to evaluate.
10
- * @returns A boolean indicating whether the filepath is an absolute path in POSIX.
11
- */
12
- export declare function pathIsAbsolutePosix(filepath: string): boolean;
13
- /**
14
- * Determines if a given filepath is an absolute path in Windows.
15
- * @param filepath - The filepath to evaluate.
16
- * @returns A boolean indicating whether the filepath is an absolute path in Windows.
17
- */
18
- export declare function pathIsAbsoluteWindows(filepath: string): boolean;
19
- //# sourceMappingURL=pathIsAbsolute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathIsAbsolute.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/pathIsAbsolute.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAmE,CAAA;AAEtH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE/D"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pathIsAbsoluteWindows = exports.pathIsAbsolutePosix = exports.pathIsAbsolute = void 0;
4
- const os_1 = require("@bemoje/os");
5
- const pathIsRelativeWindows_1 = require("./pathIsRelativeWindows");
6
- /**
7
- * Determines if a given filepath is an absolute path.
8
- * @param filepath - The filepath to evaluate.
9
- * @returns A boolean indicating whether the filepath is an absolute path in Windows.
10
- */
11
- exports.pathIsAbsolute = (0, os_1.isWindows)() ? pathIsAbsoluteWindows : pathIsAbsolutePosix;
12
- /**
13
- * Determines if a given filepath is an absolute path in POSIX.
14
- * @param filepath - The filepath to evaluate.
15
- * @returns A boolean indicating whether the filepath is an absolute path in POSIX.
16
- */
17
- function pathIsAbsolutePosix(filepath) {
18
- return filepath.charAt(0) === '/';
19
- }
20
- exports.pathIsAbsolutePosix = pathIsAbsolutePosix;
21
- /**
22
- * Determines if a given filepath is an absolute path in Windows.
23
- * @param filepath - The filepath to evaluate.
24
- * @returns A boolean indicating whether the filepath is an absolute path in Windows.
25
- */
26
- function pathIsAbsoluteWindows(filepath) {
27
- return /^([\\/]|[a-zA-Z]:)[\\/]/.test(filepath) || !(0, pathIsRelativeWindows_1.pathIsRelativeWindows)(filepath);
28
- }
29
- exports.pathIsAbsoluteWindows = pathIsAbsoluteWindows;
30
- //# sourceMappingURL=pathIsAbsolute.js.map