@zenfs/core 2.4.0 → 2.4.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.
- package/dist/path.js +3 -25
- package/package.json +1 -1
package/dist/path.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
2
|
-
/*
|
|
3
|
-
Copyright Joyent, Inc. and other Node contributors.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
|
6
|
-
copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
10
|
-
persons to whom the Software is furnished to do so, subject to the
|
|
11
|
-
following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included
|
|
14
|
-
in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17
|
-
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
19
|
-
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
20
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
22
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
2
|
import { defaultContext } from './internal/contexts.js';
|
|
25
3
|
import { globToRegex } from './utils.js';
|
|
26
4
|
export const sep = '/';
|
|
@@ -124,8 +102,8 @@ export function resolve(...parts) {
|
|
|
124
102
|
export function normalize(path) {
|
|
125
103
|
if (!path.length)
|
|
126
104
|
return '.';
|
|
127
|
-
const isAbsolute = path
|
|
128
|
-
const trailingSeparator = path.
|
|
105
|
+
const isAbsolute = path[0] === '/';
|
|
106
|
+
const trailingSeparator = path.at(-1) === '/';
|
|
129
107
|
// Normalize the path
|
|
130
108
|
path = normalizeString(path, !isAbsolute);
|
|
131
109
|
if (!path.length) {
|
|
@@ -143,7 +121,7 @@ export function isAbsolute(path) {
|
|
|
143
121
|
export function join(...parts) {
|
|
144
122
|
if (!parts.length)
|
|
145
123
|
return '.';
|
|
146
|
-
const joined = parts.join('/');
|
|
124
|
+
const joined = parts.filter(p => p).join('/');
|
|
147
125
|
if (!joined?.length)
|
|
148
126
|
return '.';
|
|
149
127
|
return normalize(joined);
|