@bemoje/path 1.1.2 → 1.1.3

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 (2) hide show
  1. package/README.md +23 -22
  2. package/package.json +13 -153
package/README.md CHANGED
@@ -2,8 +2,29 @@
2
2
 
3
3
  Cross-platform path utilities extending upath with validation, manipulation, and inspection helpers.
4
4
 
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
6
- [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/) [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
6
+
7
+ ## Exports
8
+
9
+ <!-- EXPORTS_START -->
10
+
11
+ - **cwd**
12
+ - **dirnameDeep**: Returns the absolute path of the parent directory of the given path.
13
+ - **hasBasename**: Checks if a file path has any of the specified basenames.
14
+ - **hasExtname**: Checks if a file path has any of the specified file extensions.
15
+ - **hasParentDirname**: Whether fspath is a subpath of a parent directory with the given name.
16
+ - **isDotFile**: Determines if a given filepath is a dotfile.
17
+ - **isExtValid**: Check if a file extension is valid. Invalid: - empty string - single dot: "." - illegal characters: <>"|?\*:
18
+ - **isRelative**: Whether a path is a relative string, ie. not absolute.
19
+ - **isUnc**: Determines if a given filepath is a UNC path.
20
+ - **isValidWin32**.aspx
21
+ - **prefixFilename**: Append string to the beginning of the filename.
22
+ - **root**: Returns the root directory of a given path.
23
+ - **suffixFilename**: Append string to the end of the filename.
24
+ - **toCwdRelative** path to the {p} path. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
25
+ - **toWin32**: Ensures win32 backslashes are used instead of forward slashes.
26
+
27
+ <!-- EXPORTS_END -->
7
28
 
8
29
  ## Installation
9
30
 
@@ -73,23 +94,3 @@ dirnameDeep('a/b/c/d', 2) // 'a/b'
73
94
  root('/home/user') // '/'
74
95
  toWin32('path/to/file') // 'path\\to\\file'
75
96
  ```
76
-
77
- ## API Reference
78
-
79
- | Export | Description |
80
- | ------------------ | ---------------------------------------------- |
81
- | `cwd` | Join paths from process.cwd() |
82
- | `toCwdRelative` | Convert absolute path to cwd-relative |
83
- | `prefixFilename` | Prepend string to filename |
84
- | `suffixFilename` | Append string to filename (before extension) |
85
- | `dirnameDeep` | Get parent directory N levels up |
86
- | `hasBasename` | Check if path has a specific basename |
87
- | `hasExtname` | Check if path has specific extension(s) |
88
- | `hasParentDirname` | Check if path is under a parent directory name |
89
- | `isDotFile` | Check if path is a dotfile |
90
- | `isExtValid` | Validate a file extension |
91
- | `isRelative` | Check if path is relative |
92
- | `isUnc` | Check if path is a UNC path |
93
- | `isValidWin32` | Validate a Windows file path |
94
- | `root` | Get root directory of a path |
95
- | `toWin32` | Convert forward slashes to backslashes |
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@bemoje/path",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Cross-platform path utilities extending upath with validation, manipulation, and inspection helpers.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "dependencies": {
11
+ "upath": "^2.0.1"
12
+ },
7
13
  "keywords": [
8
14
  "path",
9
15
  "cross-platform",
@@ -34,147 +40,7 @@
34
40
  "default": "./lib/index.cjs"
35
41
  }
36
42
  },
37
- "./cwd": {
38
- "import": {
39
- "types": "./lib/index.d.ts",
40
- "default": "./lib/index.js"
41
- },
42
- "require": {
43
- "types": "./lib/index.d.cts",
44
- "default": "./lib/index.cjs"
45
- }
46
- },
47
- "./dirnameDeep": {
48
- "import": {
49
- "types": "./lib/index.d.ts",
50
- "default": "./lib/index.js"
51
- },
52
- "require": {
53
- "types": "./lib/index.d.cts",
54
- "default": "./lib/index.cjs"
55
- }
56
- },
57
- "./hasBasename": {
58
- "import": {
59
- "types": "./lib/index.d.ts",
60
- "default": "./lib/index.js"
61
- },
62
- "require": {
63
- "types": "./lib/index.d.cts",
64
- "default": "./lib/index.cjs"
65
- }
66
- },
67
- "./hasExtname": {
68
- "import": {
69
- "types": "./lib/index.d.ts",
70
- "default": "./lib/index.js"
71
- },
72
- "require": {
73
- "types": "./lib/index.d.cts",
74
- "default": "./lib/index.cjs"
75
- }
76
- },
77
- "./hasParentDirname": {
78
- "import": {
79
- "types": "./lib/index.d.ts",
80
- "default": "./lib/index.js"
81
- },
82
- "require": {
83
- "types": "./lib/index.d.cts",
84
- "default": "./lib/index.cjs"
85
- }
86
- },
87
- "./isDotFile": {
88
- "import": {
89
- "types": "./lib/index.d.ts",
90
- "default": "./lib/index.js"
91
- },
92
- "require": {
93
- "types": "./lib/index.d.cts",
94
- "default": "./lib/index.cjs"
95
- }
96
- },
97
- "./isExtValid": {
98
- "import": {
99
- "types": "./lib/index.d.ts",
100
- "default": "./lib/index.js"
101
- },
102
- "require": {
103
- "types": "./lib/index.d.cts",
104
- "default": "./lib/index.cjs"
105
- }
106
- },
107
- "./isRelative": {
108
- "import": {
109
- "types": "./lib/index.d.ts",
110
- "default": "./lib/index.js"
111
- },
112
- "require": {
113
- "types": "./lib/index.d.cts",
114
- "default": "./lib/index.cjs"
115
- }
116
- },
117
- "./isUnc": {
118
- "import": {
119
- "types": "./lib/index.d.ts",
120
- "default": "./lib/index.js"
121
- },
122
- "require": {
123
- "types": "./lib/index.d.cts",
124
- "default": "./lib/index.cjs"
125
- }
126
- },
127
- "./isValidWin32": {
128
- "import": {
129
- "types": "./lib/index.d.ts",
130
- "default": "./lib/index.js"
131
- },
132
- "require": {
133
- "types": "./lib/index.d.cts",
134
- "default": "./lib/index.cjs"
135
- }
136
- },
137
- "./prefixFilename": {
138
- "import": {
139
- "types": "./lib/index.d.ts",
140
- "default": "./lib/index.js"
141
- },
142
- "require": {
143
- "types": "./lib/index.d.cts",
144
- "default": "./lib/index.cjs"
145
- }
146
- },
147
- "./root": {
148
- "import": {
149
- "types": "./lib/index.d.ts",
150
- "default": "./lib/index.js"
151
- },
152
- "require": {
153
- "types": "./lib/index.d.cts",
154
- "default": "./lib/index.cjs"
155
- }
156
- },
157
- "./suffixFilename": {
158
- "import": {
159
- "types": "./lib/index.d.ts",
160
- "default": "./lib/index.js"
161
- },
162
- "require": {
163
- "types": "./lib/index.d.cts",
164
- "default": "./lib/index.cjs"
165
- }
166
- },
167
- "./toCwdRelative": {
168
- "import": {
169
- "types": "./lib/index.d.ts",
170
- "default": "./lib/index.js"
171
- },
172
- "require": {
173
- "types": "./lib/index.d.cts",
174
- "default": "./lib/index.cjs"
175
- }
176
- },
177
- "./toWin32": {
43
+ "./*": {
178
44
  "import": {
179
45
  "types": "./lib/index.d.ts",
180
46
  "default": "./lib/index.js"
@@ -185,21 +51,15 @@
185
51
  }
186
52
  }
187
53
  },
188
- "dependencies": {
189
- "upath": "^2.0.1"
190
- },
191
- "publishConfig": {
192
- "access": "public"
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/bemoje/mono.git",
57
+ "directory": "libs/path"
193
58
  },
194
- "license": "MIT",
195
59
  "author": {
196
60
  "name": "Benjamin Møller Jensen",
197
61
  "email": "bemoje@bemoje.net",
198
62
  "url": "https://github.com/bemoje/"
199
63
  },
200
- "repository": {
201
- "type": "git",
202
- "url": "git+https://github.com/bemoje/mono.git",
203
- "directory": "libs/path"
204
- }
64
+ "license": "MIT"
205
65
  }