@stryke/path 0.18.1 → 0.18.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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _correctPath = require("./correct-path.cjs");
|
|
4
|
+
describe("stripStars", () => {
|
|
5
|
+
it("stripStars - single star", () => {
|
|
6
|
+
const t = (0, _correctPath.stripStars)("hello/*");
|
|
7
|
+
expect(t).toBe("hello");
|
|
8
|
+
}), it("stripStars - multiple stars", () => {
|
|
9
|
+
const t = (0, _correctPath.stripStars)("hello/**/*");
|
|
10
|
+
expect(t).toBe("hello");
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stripStars as s}from"./correct-path";describe("stripStars",()=>{it("stripStars - single star",()=>{const t=s("hello/*");expect(t).toBe("hello")}),it("stripStars - multiple stars",()=>{const t=s("hello/**/*");expect(t).toBe("hello")})});
|
package/dist/is-parent-path.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isParentPath = isParentPath;
|
|
7
7
|
var _slash = require("./slash.cjs");
|
|
8
|
-
function isParentPath(
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
return
|
|
8
|
+
function isParentPath(l, c) {
|
|
9
|
+
const e = (0, _slash.slash)(l.replace(/\/+/g, "/").replace(/\/+$/, "")),
|
|
10
|
+
r = (0, _slash.slash)(c.replace(/\/+/g, "/").replace(/\/+$/, ""));
|
|
11
|
+
return e.replace(/^\/+/g, "").replace(/\/+$/g, "") !== r.replace(/^\/+/g, "").replace(/\/+$/g, "") && e.replace(/^\/+/g, "").replace(/\/+$/g, "").startsWith(r.replace(/^\/+/g, "").replace(/\/+$/g, ""));
|
|
12
12
|
}
|
package/dist/is-parent-path.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{slash as
|
|
1
|
+
import{slash as a}from"./slash";export function isParentPath(l,c){const e=a(l.replace(/\/+/g,"/").replace(/\/+$/,"")),r=a(c.replace(/\/+/g,"/").replace(/\/+$/,""));return e.replace(/^\/+/g,"").replace(/\/+$/g,"")!==r.replace(/^\/+/g,"").replace(/\/+$/g,"")&&e.replace(/^\/+/g,"").replace(/\/+$/g,"").startsWith(r.replace(/^\/+/g,"").replace(/\/+$/g,""))}
|
package/dist/replace.cjs
CHANGED
|
@@ -10,9 +10,9 @@ var _cwd = require("./cwd.cjs");
|
|
|
10
10
|
var _filePathFns = require("./file-path-fns.cjs");
|
|
11
11
|
var _isParentPath = require("./is-parent-path.cjs");
|
|
12
12
|
var _slash = require("./slash.cjs");
|
|
13
|
-
function replacePath(r,
|
|
14
|
-
return (0, _correctPath.correctPath)((0, _isParentPath.isParentPath)(r,
|
|
13
|
+
function replacePath(r, e = (0, _cwd.cwd)()) {
|
|
14
|
+
return (0, _correctPath.correctPath)((0, _isParentPath.isParentPath)(r, e) ? (0, _slash.slash)(r).replace(/^\/+/g, "").replace(/\/+$/g, "").replace((0, _slash.slash)(e).replace(/^\/+/g, "").replace(/\/+$/g, ""), "") : r);
|
|
15
15
|
}
|
|
16
|
-
function replaceExtension(r,
|
|
17
|
-
return (0, _correctPath.correctPath)(r.replace(!
|
|
16
|
+
function replaceExtension(r, e = "") {
|
|
17
|
+
return (0, _correctPath.correctPath)(r.replace(!e || e.includes(".") ? (0, _filePathFns.findFileDotExtensionSafe)(r) : (0, _filePathFns.findFileExtensionSafe)(r), e));
|
|
18
18
|
}
|
package/dist/replace.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{correctPath as
|
|
1
|
+
import{correctPath as i}from"./correct-path";import{cwd as n}from"./cwd";import{findFileDotExtensionSafe as t,findFileExtensionSafe as s}from"./file-path-fns";import{isParentPath as f}from"./is-parent-path";import{slash as o}from"./slash";export function replacePath(r,e=n()){return i(f(r,e)?o(r).replace(/^\/+/g,"").replace(/\/+$/g,"").replace(o(e).replace(/^\/+/g,"").replace(/\/+$/g,""),""):r)}export function replaceExtension(r,e=""){return i(r.replace(!e||e.includes(".")?t(r):s(r),e))}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/path",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various utilities that expand the functionality of NodeJs's built-in `path` module",
|
|
6
6
|
"repository": {
|
|
@@ -239,6 +239,20 @@
|
|
|
239
239
|
"default": "./dist/correct-path.mjs"
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
|
+
"./correct-path.spec": {
|
|
243
|
+
"import": {
|
|
244
|
+
"types": "./dist/correct-path.spec.d.ts",
|
|
245
|
+
"default": "./dist/correct-path.spec.mjs"
|
|
246
|
+
},
|
|
247
|
+
"require": {
|
|
248
|
+
"types": "./dist/correct-path.spec.d.ts",
|
|
249
|
+
"default": "./dist/correct-path.spec.cjs"
|
|
250
|
+
},
|
|
251
|
+
"default": {
|
|
252
|
+
"types": "./dist/correct-path.spec.d.ts",
|
|
253
|
+
"default": "./dist/correct-path.spec.mjs"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
242
256
|
"./asset-extensions": {
|
|
243
257
|
"import": {
|
|
244
258
|
"types": "./dist/asset-extensions.d.ts",
|
|
@@ -280,5 +294,5 @@
|
|
|
280
294
|
"main": "./dist/index.cjs",
|
|
281
295
|
"module": "./dist/index.mjs",
|
|
282
296
|
"types": "./dist/index.d.ts",
|
|
283
|
-
"gitHead": "
|
|
297
|
+
"gitHead": "b72f1ffff997334f9986d1dea1124e720cf71ff4"
|
|
284
298
|
}
|