@bemoje/path 1.0.1 → 1.1.1

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 (66) hide show
  1. package/lib/index.cjs +174 -0
  2. package/lib/index.d.cts +16 -0
  3. package/lib/index.d.ts +16 -0
  4. package/lib/lib/cwd.cjs +16 -0
  5. package/lib/lib/cwd.d.cts +11 -0
  6. package/lib/lib/cwd.d.ts +11 -0
  7. package/lib/lib/cwd.js +10 -0
  8. package/lib/lib/dirnameDeep.cjs +17 -0
  9. package/lib/lib/dirnameDeep.d.cts +9 -0
  10. package/lib/lib/dirnameDeep.d.ts +9 -0
  11. package/lib/lib/dirnameDeep.js +11 -0
  12. package/lib/lib/hasBasename.cjs +18 -0
  13. package/lib/lib/hasBasename.d.cts +8 -0
  14. package/lib/lib/hasBasename.d.ts +8 -0
  15. package/lib/lib/hasBasename.js +12 -0
  16. package/lib/lib/hasExtname.cjs +60 -0
  17. package/lib/lib/hasExtname.d.cts +15 -0
  18. package/lib/lib/hasExtname.d.ts +15 -0
  19. package/lib/lib/hasExtname.js +58 -0
  20. package/lib/lib/hasParentDirname.cjs +12 -0
  21. package/lib/lib/hasParentDirname.d.cts +6 -0
  22. package/lib/lib/hasParentDirname.d.ts +6 -0
  23. package/lib/lib/hasParentDirname.js +10 -0
  24. package/lib/lib/isDotFile.cjs +12 -0
  25. package/lib/lib/isDotFile.d.cts +8 -0
  26. package/lib/lib/isDotFile.d.ts +8 -0
  27. package/lib/lib/isDotFile.js +10 -0
  28. package/lib/lib/isExtValid.cjs +12 -0
  29. package/lib/lib/isExtValid.d.cts +13 -0
  30. package/lib/lib/isExtValid.d.ts +13 -0
  31. package/lib/lib/isExtValid.js +10 -0
  32. package/lib/lib/isRelative.cjs +16 -0
  33. package/lib/lib/isRelative.d.cts +6 -0
  34. package/lib/lib/isRelative.d.ts +6 -0
  35. package/lib/lib/isRelative.js +10 -0
  36. package/lib/lib/isUnc.cjs +12 -0
  37. package/lib/lib/isUnc.d.cts +8 -0
  38. package/lib/lib/isUnc.d.ts +8 -0
  39. package/lib/lib/isUnc.js +10 -0
  40. package/lib/lib/isValidWin32.cjs +29 -0
  41. package/lib/lib/isValidWin32.d.cts +11 -0
  42. package/lib/lib/isValidWin32.d.ts +11 -0
  43. package/lib/lib/isValidWin32.js +27 -0
  44. package/lib/lib/prefixFilename.cjs +18 -0
  45. package/lib/lib/prefixFilename.d.cts +11 -0
  46. package/lib/lib/prefixFilename.d.ts +11 -0
  47. package/lib/lib/prefixFilename.js +12 -0
  48. package/lib/lib/root.cjs +16 -0
  49. package/lib/lib/root.d.cts +6 -0
  50. package/lib/lib/root.d.ts +6 -0
  51. package/lib/lib/root.js +10 -0
  52. package/lib/lib/suffixFilename.cjs +18 -0
  53. package/lib/lib/suffixFilename.d.cts +11 -0
  54. package/lib/lib/suffixFilename.d.ts +11 -0
  55. package/lib/lib/suffixFilename.js +12 -0
  56. package/lib/lib/toCwdRelative.cjs +16 -0
  57. package/lib/lib/toCwdRelative.d.cts +8 -0
  58. package/lib/lib/toCwdRelative.d.ts +8 -0
  59. package/lib/lib/toCwdRelative.js +10 -0
  60. package/lib/lib/toWin32.cjs +12 -0
  61. package/lib/lib/toWin32.d.cts +6 -0
  62. package/lib/lib/toWin32.d.ts +6 -0
  63. package/lib/lib/toWin32.js +10 -0
  64. package/package.json +249 -19
  65. package/index.d.ts +0 -121
  66. /package/{index.mjs → lib/index.js} +0 -0
package/lib/index.cjs ADDED
@@ -0,0 +1,174 @@
1
+ 'use strict';
2
+
3
+ var upath4 = require('upath');
4
+ var path = require('path');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var upath4__default = /*#__PURE__*/_interopDefault(upath4);
9
+ var path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
+ function cwd(...p) {
14
+ return upath4__default.default.joinSafe(process.cwd(), ...p);
15
+ }
16
+ __name(cwd, "cwd");
17
+ function dirnameDeep(p, depth) {
18
+ const parent = upath4__default.default.dirname(p);
19
+ return depth && depth > 1 ? dirnameDeep(parent, depth - 1) : parent;
20
+ }
21
+ __name(dirnameDeep, "dirnameDeep");
22
+ function hasBasename(tsFilepath, basenames) {
23
+ return [
24
+ basenames
25
+ ].flat(2).includes(upath4__default.default.basename(tsFilepath));
26
+ }
27
+ __name(hasBasename, "hasBasename");
28
+
29
+ // ../fn/src/setNameAndLength.ts
30
+ function setNameAndLength(source, target, lengthDelta = 0) {
31
+ return Object.defineProperties(target, {
32
+ name: {
33
+ configurable: true,
34
+ value: source.name
35
+ },
36
+ length: {
37
+ configurable: true,
38
+ value: source.length + lengthDelta
39
+ }
40
+ });
41
+ }
42
+ __name(setNameAndLength, "setNameAndLength");
43
+
44
+ // ../fn/src/bindArg.ts
45
+ function bindArg(fn, boundArgIndex, boundArgValue) {
46
+ return setNameAndLength(fn, (...args) => {
47
+ return fn(...args.slice(0, boundArgIndex), boundArgValue, ...args.slice(boundArgIndex));
48
+ }, -1);
49
+ }
50
+ __name(bindArg, "bindArg");
51
+
52
+ // src/lib/hasExtname.ts
53
+ function hasExtname(tsFilepath, extnames) {
54
+ return new RegExp(`[.](${[
55
+ extnames
56
+ ].flat(2).join("|")})$`).test(tsFilepath);
57
+ }
58
+ __name(hasExtname, "hasExtname");
59
+ hasExtname.js = bindArg(hasExtname, 1, [
60
+ "js",
61
+ "mjs",
62
+ "jsx",
63
+ "cjs"
64
+ ]);
65
+ hasExtname.json = bindArg(hasExtname, 1, [
66
+ "json",
67
+ "jsonc"
68
+ ]);
69
+ hasExtname.yaml = bindArg(hasExtname, 1, [
70
+ "yaml",
71
+ "yml"
72
+ ]);
73
+ hasExtname.markdown = bindArg(hasExtname, 1, [
74
+ "md",
75
+ "markdown"
76
+ ]);
77
+ hasExtname.ts = bindArg(hasExtname, 1, [
78
+ "ts",
79
+ "mts",
80
+ "tsx"
81
+ ]);
82
+
83
+ // src/lib/hasParentDirname.ts
84
+ function hasParentDirname(fspath, name) {
85
+ return new RegExp(`(^|[/\\\\])${name}[/\\\\]`).test(fspath);
86
+ }
87
+ __name(hasParentDirname, "hasParentDirname");
88
+
89
+ // src/lib/isDotFile.ts
90
+ function isDotFile(filepath) {
91
+ return /(?:^|[/\\])(\.(?!\.)[^/\\]+)$/.test(filepath);
92
+ }
93
+ __name(isDotFile, "isDotFile");
94
+
95
+ // src/lib/isExtValid.ts
96
+ function isExtValid(ext) {
97
+ return !!ext && ext !== "." && !/["*:<>?|]/.test(ext);
98
+ }
99
+ __name(isExtValid, "isExtValid");
100
+ function isRelative(p) {
101
+ return !path__default.default.isAbsolute(p);
102
+ }
103
+ __name(isRelative, "isRelative");
104
+
105
+ // src/lib/isUnc.ts
106
+ function isUnc(filepath) {
107
+ return /^[/\\]{2,}[^/\\]+[/\\]+[^/\\]+/.test(filepath);
108
+ }
109
+ __name(isUnc, "isUnc");
110
+
111
+ // src/lib/isValidWin32.ts
112
+ function isValidWin32(path2, options) {
113
+ if (path2.length === 0) {
114
+ return false;
115
+ }
116
+ if (path2.includes("/") && path2.includes("\\")) {
117
+ return false;
118
+ }
119
+ const maxLength = (options && options.extendedMaxLength ? 32767 : 260) - 12;
120
+ if (path2.length > maxLength) {
121
+ return false;
122
+ }
123
+ const noDriveLetter = /^\w:(\\|\/)/g.test(path2) ? path2.substring(2) : path2;
124
+ if (/["*:<>?|]/g.test(noDriveLetter)) {
125
+ return false;
126
+ }
127
+ if (/(\\|\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\|\/)|$)/g.test(path2)) {
128
+ return false;
129
+ }
130
+ return true;
131
+ }
132
+ __name(isValidWin32, "isValidWin32");
133
+ function prefixFilename(filePath, prefix) {
134
+ const ext = upath4__default.default.extname(filePath);
135
+ const fileNameWithoutExt = upath4__default.default.basename(filePath, ext);
136
+ return upath4__default.default.joinSafe(upath4__default.default.dirname(filePath), prefix + fileNameWithoutExt + ext);
137
+ }
138
+ __name(prefixFilename, "prefixFilename");
139
+ function root(p) {
140
+ return upath4__default.default.parse(p).root;
141
+ }
142
+ __name(root, "root");
143
+ function suffixFilename(filePath, suffix) {
144
+ const split = upath4__default.default.basename(filePath).split(".");
145
+ split[0] += suffix;
146
+ return upath4__default.default.joinSafe(upath4__default.default.dirname(filePath), split.join("."));
147
+ }
148
+ __name(suffixFilename, "suffixFilename");
149
+ function toCwdRelative(p) {
150
+ return upath4__default.default.relative(process.cwd(), p);
151
+ }
152
+ __name(toCwdRelative, "toCwdRelative");
153
+
154
+ // src/lib/toWin32.ts
155
+ function toWin32(p) {
156
+ return p.replaceAll("/", "\\");
157
+ }
158
+ __name(toWin32, "toWin32");
159
+
160
+ exports.cwd = cwd;
161
+ exports.dirnameDeep = dirnameDeep;
162
+ exports.hasBasename = hasBasename;
163
+ exports.hasExtname = hasExtname;
164
+ exports.hasParentDirname = hasParentDirname;
165
+ exports.isDotFile = isDotFile;
166
+ exports.isExtValid = isExtValid;
167
+ exports.isRelative = isRelative;
168
+ exports.isUnc = isUnc;
169
+ exports.isValidWin32 = isValidWin32;
170
+ exports.prefixFilename = prefixFilename;
171
+ exports.root = root;
172
+ exports.suffixFilename = suffixFilename;
173
+ exports.toCwdRelative = toCwdRelative;
174
+ exports.toWin32 = toWin32;
@@ -0,0 +1,16 @@
1
+ export { cwd } from './lib/cwd.cjs';
2
+ export { dirnameDeep } from './lib/dirnameDeep.cjs';
3
+ export { hasBasename } from './lib/hasBasename.cjs';
4
+ export { hasExtname } from './lib/hasExtname.cjs';
5
+ export { hasParentDirname } from './lib/hasParentDirname.cjs';
6
+ export { isDotFile } from './lib/isDotFile.cjs';
7
+ export { isExtValid } from './lib/isExtValid.cjs';
8
+ export { isRelative } from './lib/isRelative.cjs';
9
+ export { isUnc } from './lib/isUnc.cjs';
10
+ export { isValidWin32 } from './lib/isValidWin32.cjs';
11
+ export { prefixFilename } from './lib/prefixFilename.cjs';
12
+ export { root } from './lib/root.cjs';
13
+ export { suffixFilename } from './lib/suffixFilename.cjs';
14
+ export { toCwdRelative } from './lib/toCwdRelative.cjs';
15
+ export { toWin32 } from './lib/toWin32.cjs';
16
+ import './arrayable.d-1twOP8Y1.cjs';
package/lib/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export { cwd } from './lib/cwd.js';
2
+ export { dirnameDeep } from './lib/dirnameDeep.js';
3
+ export { hasBasename } from './lib/hasBasename.js';
4
+ export { hasExtname } from './lib/hasExtname.js';
5
+ export { hasParentDirname } from './lib/hasParentDirname.js';
6
+ export { isDotFile } from './lib/isDotFile.js';
7
+ export { isExtValid } from './lib/isExtValid.js';
8
+ export { isRelative } from './lib/isRelative.js';
9
+ export { isUnc } from './lib/isUnc.js';
10
+ export { isValidWin32 } from './lib/isValidWin32.js';
11
+ export { prefixFilename } from './lib/prefixFilename.js';
12
+ export { root } from './lib/root.js';
13
+ export { suffixFilename } from './lib/suffixFilename.js';
14
+ export { toCwdRelative } from './lib/toCwdRelative.js';
15
+ export { toWin32 } from './lib/toWin32.js';
16
+ import './arrayable.d-1twOP8Y1.js';
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var upath = require('upath');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var upath__default = /*#__PURE__*/_interopDefault(upath);
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ function cwd(...p) {
12
+ return upath__default.default.joinSafe(process.cwd(), ...p);
13
+ }
14
+ __name(cwd, "cwd");
15
+
16
+ exports.cwd = cwd;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Join paths starting from process.cwd()
3
+ *
4
+ * @example ```ts
5
+ * // equivalent to:
6
+ * path.join(process.cwd(), ...p)
7
+ * ```
8
+ */
9
+ declare function cwd(...p: string[]): string;
10
+
11
+ export { cwd };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Join paths starting from process.cwd()
3
+ *
4
+ * @example ```ts
5
+ * // equivalent to:
6
+ * path.join(process.cwd(), ...p)
7
+ * ```
8
+ */
9
+ declare function cwd(...p: string[]): string;
10
+
11
+ export { cwd };
package/lib/lib/cwd.js ADDED
@@ -0,0 +1,10 @@
1
+ import upath from 'upath';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function cwd(...p) {
6
+ return upath.joinSafe(process.cwd(), ...p);
7
+ }
8
+ __name(cwd, "cwd");
9
+
10
+ export { cwd };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var upath = require('upath');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var upath__default = /*#__PURE__*/_interopDefault(upath);
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ function dirnameDeep(p, depth) {
12
+ const parent = upath__default.default.dirname(p);
13
+ return depth && depth > 1 ? dirnameDeep(parent, depth - 1) : parent;
14
+ }
15
+ __name(dirnameDeep, "dirnameDeep");
16
+
17
+ exports.dirnameDeep = dirnameDeep;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the absolute path of the parent directory of the given path.
3
+ * @param p the path
4
+ * @param depth how many times to get the parent directory
5
+ * @example dirnameDeep('a/b/c/d', 2) => 'a/b'
6
+ */
7
+ declare function dirnameDeep(p: string, depth?: number): string;
8
+
9
+ export { dirnameDeep };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the absolute path of the parent directory of the given path.
3
+ * @param p the path
4
+ * @param depth how many times to get the parent directory
5
+ * @example dirnameDeep('a/b/c/d', 2) => 'a/b'
6
+ */
7
+ declare function dirnameDeep(p: string, depth?: number): string;
8
+
9
+ export { dirnameDeep };
@@ -0,0 +1,11 @@
1
+ import upath from 'upath';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function dirnameDeep(p, depth) {
6
+ const parent = upath.dirname(p);
7
+ return depth && depth > 1 ? dirnameDeep(parent, depth - 1) : parent;
8
+ }
9
+ __name(dirnameDeep, "dirnameDeep");
10
+
11
+ export { dirnameDeep };
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var upath = require('upath');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var upath__default = /*#__PURE__*/_interopDefault(upath);
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ function hasBasename(tsFilepath, basenames) {
12
+ return [
13
+ basenames
14
+ ].flat(2).includes(upath__default.default.basename(tsFilepath));
15
+ }
16
+ __name(hasBasename, "hasBasename");
17
+
18
+ exports.hasBasename = hasBasename;
@@ -0,0 +1,8 @@
1
+ import { A as Arrayable } from '../arrayable.d-1twOP8Y1.cjs';
2
+
3
+ /**
4
+ * Checks if a file path has any of the specified basenames.
5
+ */
6
+ declare function hasBasename(tsFilepath: string, basenames: Arrayable<string>): boolean;
7
+
8
+ export { hasBasename };
@@ -0,0 +1,8 @@
1
+ import { A as Arrayable } from '../arrayable.d-1twOP8Y1.js';
2
+
3
+ /**
4
+ * Checks if a file path has any of the specified basenames.
5
+ */
6
+ declare function hasBasename(tsFilepath: string, basenames: Arrayable<string>): boolean;
7
+
8
+ export { hasBasename };
@@ -0,0 +1,12 @@
1
+ import upath from 'upath';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function hasBasename(tsFilepath, basenames) {
6
+ return [
7
+ basenames
8
+ ].flat(2).includes(upath.basename(tsFilepath));
9
+ }
10
+ __name(hasBasename, "hasBasename");
11
+
12
+ export { hasBasename };
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // ../fn/src/setNameAndLength.ts
7
+ function setNameAndLength(source, target, lengthDelta = 0) {
8
+ return Object.defineProperties(target, {
9
+ name: {
10
+ configurable: true,
11
+ value: source.name
12
+ },
13
+ length: {
14
+ configurable: true,
15
+ value: source.length + lengthDelta
16
+ }
17
+ });
18
+ }
19
+ __name(setNameAndLength, "setNameAndLength");
20
+
21
+ // ../fn/src/bindArg.ts
22
+ function bindArg(fn, boundArgIndex, boundArgValue) {
23
+ return setNameAndLength(fn, (...args) => {
24
+ return fn(...args.slice(0, boundArgIndex), boundArgValue, ...args.slice(boundArgIndex));
25
+ }, -1);
26
+ }
27
+ __name(bindArg, "bindArg");
28
+
29
+ // src/lib/hasExtname.ts
30
+ function hasExtname(tsFilepath, extnames) {
31
+ return new RegExp(`[.](${[
32
+ extnames
33
+ ].flat(2).join("|")})$`).test(tsFilepath);
34
+ }
35
+ __name(hasExtname, "hasExtname");
36
+ hasExtname.js = bindArg(hasExtname, 1, [
37
+ "js",
38
+ "mjs",
39
+ "jsx",
40
+ "cjs"
41
+ ]);
42
+ hasExtname.json = bindArg(hasExtname, 1, [
43
+ "json",
44
+ "jsonc"
45
+ ]);
46
+ hasExtname.yaml = bindArg(hasExtname, 1, [
47
+ "yaml",
48
+ "yml"
49
+ ]);
50
+ hasExtname.markdown = bindArg(hasExtname, 1, [
51
+ "md",
52
+ "markdown"
53
+ ]);
54
+ hasExtname.ts = bindArg(hasExtname, 1, [
55
+ "ts",
56
+ "mts",
57
+ "tsx"
58
+ ]);
59
+
60
+ exports.hasExtname = hasExtname;
@@ -0,0 +1,15 @@
1
+ import { A as Arrayable } from '../arrayable.d-1twOP8Y1.cjs';
2
+
3
+ /**
4
+ * Checks if a file path has any of the specified file extensions.
5
+ */
6
+ declare function hasExtname(tsFilepath: string, extnames: Arrayable<string>): boolean;
7
+ declare namespace hasExtname {
8
+ var js: (tsFilepath: string) => boolean;
9
+ var json: (tsFilepath: string) => boolean;
10
+ var yaml: (tsFilepath: string) => boolean;
11
+ var markdown: (tsFilepath: string) => boolean;
12
+ var ts: (tsFilepath: string) => boolean;
13
+ }
14
+
15
+ export { hasExtname };
@@ -0,0 +1,15 @@
1
+ import { A as Arrayable } from '../arrayable.d-1twOP8Y1.js';
2
+
3
+ /**
4
+ * Checks if a file path has any of the specified file extensions.
5
+ */
6
+ declare function hasExtname(tsFilepath: string, extnames: Arrayable<string>): boolean;
7
+ declare namespace hasExtname {
8
+ var js: (tsFilepath: string) => boolean;
9
+ var json: (tsFilepath: string) => boolean;
10
+ var yaml: (tsFilepath: string) => boolean;
11
+ var markdown: (tsFilepath: string) => boolean;
12
+ var ts: (tsFilepath: string) => boolean;
13
+ }
14
+
15
+ export { hasExtname };
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // ../fn/src/setNameAndLength.ts
5
+ function setNameAndLength(source, target, lengthDelta = 0) {
6
+ return Object.defineProperties(target, {
7
+ name: {
8
+ configurable: true,
9
+ value: source.name
10
+ },
11
+ length: {
12
+ configurable: true,
13
+ value: source.length + lengthDelta
14
+ }
15
+ });
16
+ }
17
+ __name(setNameAndLength, "setNameAndLength");
18
+
19
+ // ../fn/src/bindArg.ts
20
+ function bindArg(fn, boundArgIndex, boundArgValue) {
21
+ return setNameAndLength(fn, (...args) => {
22
+ return fn(...args.slice(0, boundArgIndex), boundArgValue, ...args.slice(boundArgIndex));
23
+ }, -1);
24
+ }
25
+ __name(bindArg, "bindArg");
26
+
27
+ // src/lib/hasExtname.ts
28
+ function hasExtname(tsFilepath, extnames) {
29
+ return new RegExp(`[.](${[
30
+ extnames
31
+ ].flat(2).join("|")})$`).test(tsFilepath);
32
+ }
33
+ __name(hasExtname, "hasExtname");
34
+ hasExtname.js = bindArg(hasExtname, 1, [
35
+ "js",
36
+ "mjs",
37
+ "jsx",
38
+ "cjs"
39
+ ]);
40
+ hasExtname.json = bindArg(hasExtname, 1, [
41
+ "json",
42
+ "jsonc"
43
+ ]);
44
+ hasExtname.yaml = bindArg(hasExtname, 1, [
45
+ "yaml",
46
+ "yml"
47
+ ]);
48
+ hasExtname.markdown = bindArg(hasExtname, 1, [
49
+ "md",
50
+ "markdown"
51
+ ]);
52
+ hasExtname.ts = bindArg(hasExtname, 1, [
53
+ "ts",
54
+ "mts",
55
+ "tsx"
56
+ ]);
57
+
58
+ export { hasExtname };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/lib/hasParentDirname.ts
7
+ function hasParentDirname(fspath, name) {
8
+ return new RegExp(`(^|[/\\\\])${name}[/\\\\]`).test(fspath);
9
+ }
10
+ __name(hasParentDirname, "hasParentDirname");
11
+
12
+ exports.hasParentDirname = hasParentDirname;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether fspath is a subpath of a parent directory with the given name.
3
+ */
4
+ declare function hasParentDirname(fspath: string, name: string): boolean;
5
+
6
+ export { hasParentDirname };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether fspath is a subpath of a parent directory with the given name.
3
+ */
4
+ declare function hasParentDirname(fspath: string, name: string): boolean;
5
+
6
+ export { hasParentDirname };
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/lib/hasParentDirname.ts
5
+ function hasParentDirname(fspath, name) {
6
+ return new RegExp(`(^|[/\\\\])${name}[/\\\\]`).test(fspath);
7
+ }
8
+ __name(hasParentDirname, "hasParentDirname");
9
+
10
+ export { hasParentDirname };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/lib/isDotFile.ts
7
+ function isDotFile(filepath) {
8
+ return /(?:^|[/\\])(\.(?!\.)[^/\\]+)$/.test(filepath);
9
+ }
10
+ __name(isDotFile, "isDotFile");
11
+
12
+ exports.isDotFile = isDotFile;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Determines if a given filepath is a dotfile.
3
+ * @param filepath - The filepath to evaluate.
4
+ * @returns A boolean indicating whether the filepath is a dotfile.
5
+ */
6
+ declare function isDotFile(filepath: string): boolean;
7
+
8
+ export { isDotFile };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Determines if a given filepath is a dotfile.
3
+ * @param filepath - The filepath to evaluate.
4
+ * @returns A boolean indicating whether the filepath is a dotfile.
5
+ */
6
+ declare function isDotFile(filepath: string): boolean;
7
+
8
+ export { isDotFile };
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/lib/isDotFile.ts
5
+ function isDotFile(filepath) {
6
+ return /(?:^|[/\\])(\.(?!\.)[^/\\]+)$/.test(filepath);
7
+ }
8
+ __name(isDotFile, "isDotFile");
9
+
10
+ export { isDotFile };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/lib/isExtValid.ts
7
+ function isExtValid(ext) {
8
+ return !!ext && ext !== "." && !/["*:<>?|]/.test(ext);
9
+ }
10
+ __name(isExtValid, "isExtValid");
11
+
12
+ exports.isExtValid = isExtValid;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a file extension is valid.
3
+ *
4
+ * Invalid:
5
+ * - empty string
6
+ * - single dot: "."
7
+ * - illegal characters: <>"|?*:
8
+ *
9
+ * @param ext - The file extension to check.
10
+ */
11
+ declare function isExtValid(ext: string): boolean;
12
+
13
+ export { isExtValid };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a file extension is valid.
3
+ *
4
+ * Invalid:
5
+ * - empty string
6
+ * - single dot: "."
7
+ * - illegal characters: <>"|?*:
8
+ *
9
+ * @param ext - The file extension to check.
10
+ */
11
+ declare function isExtValid(ext: string): boolean;
12
+
13
+ export { isExtValid };
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/lib/isExtValid.ts
5
+ function isExtValid(ext) {
6
+ return !!ext && ext !== "." && !/["*:<>?|]/.test(ext);
7
+ }
8
+ __name(isExtValid, "isExtValid");
9
+
10
+ export { isExtValid };