@jsenv/filesystem 2.7.1 → 2.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/filesystem",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "Collection of functions to interact with filesystem in Node.js",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -16,7 +16,8 @@
16
16
  "node": ">=16.13.0"
17
17
  },
18
18
  "publishConfig": {
19
- "access": "public"
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org"
20
21
  },
21
22
  "type": "module",
22
23
  "exports": {
@@ -55,4 +56,4 @@
55
56
  "eslint-plugin-import": "2.25.4",
56
57
  "prettier": "2.5.1"
57
58
  }
58
- }
59
+ }
@@ -10,7 +10,6 @@ export const getCommonPathname = (pathname, otherPathname) => {
10
10
  }
11
11
 
12
12
  const commonString = pathname.slice(0, firstDifferentCharacterIndex + 1)
13
-
14
13
  // the first different char is at firstDifferentCharacterIndex
15
14
  if (pathname.charAt(firstDifferentCharacterIndex) === "/") {
16
15
  return commonString
@@ -8,7 +8,12 @@ export const urlToPathname = (url) => {
8
8
 
9
9
  const ressourceToPathname = (ressource) => {
10
10
  const searchSeparatorIndex = ressource.indexOf("?")
11
- return searchSeparatorIndex === -1
12
- ? ressource
13
- : ressource.slice(0, searchSeparatorIndex)
11
+ if (searchSeparatorIndex > -1) {
12
+ return ressource.slice(0, searchSeparatorIndex)
13
+ }
14
+ const hashIndex = ressource.indexOf("#")
15
+ if (hashIndex > -1) {
16
+ return ressource.slice(0, hashIndex)
17
+ }
18
+ return ressource
14
19
  }
@@ -31,7 +31,6 @@ export const urlToRelativeUrl = (url, baseUrl) => {
31
31
  const urlAsString = String(url)
32
32
  return urlAsString
33
33
  }
34
-
35
34
  const specificPathname = pathname.slice(commonPathname.length)
36
35
  const baseSpecificPathname = basePathname.slice(commonPathname.length)
37
36
  if (baseSpecificPathname.includes("/")) {