@stryke/path 0.18.4 → 0.18.5

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/append.cjs CHANGED
@@ -10,6 +10,6 @@ var _isParentPath = require("./is-parent-path.cjs");
10
10
  var _joinPaths = require("./join-paths.cjs");
11
11
  var _slash = require("./slash.cjs");
12
12
  function appendPath(r, o = (0, _cwd.cwd)()) {
13
- return (0, _slash.formatSlash)((0, _isParentPath.isParentPath)(r, o) ? r : (0, _joinPaths.joinPaths)(o, r));
13
+ return (0, _slash.slash)((0, _isParentPath.isParentPath)(r, o) ? r : (0, _joinPaths.joinPaths)(o, r));
14
14
  }
15
15
  const append = exports.append = appendPath;
package/dist/append.mjs CHANGED
@@ -1 +1 @@
1
- import{cwd as t}from"./cwd";import{isParentPath as n}from"./is-parent-path";import{joinPaths as m}from"./join-paths";import{formatSlash as p}from"./slash";export function appendPath(r,o=t()){return p(n(r,o)?r:m(o,r))}export const append=appendPath;
1
+ import{cwd as t}from"./cwd";import{isParentPath as n}from"./is-parent-path";import{joinPaths as p}from"./join-paths";import{slash as i}from"./slash";export function appendPath(r,o=t()){return i(n(r,o)?r:p(o,r))}export const append=appendPath;
@@ -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(o, a) {
9
- const r = (0, _slash.formatSlash)(o),
10
- n = (0, _slash.formatSlash)(a);
11
- return (0, _slash.formatSlash)(r) !== (0, _slash.formatSlash)(n) && (0, _slash.formatSlash)(r).startsWith((0, _slash.formatSlash)(n));
8
+ function isParentPath(a, n) {
9
+ const r = (0, _slash.slash)(a.replace(/\\/g, "/").replace(/\/$/, "")),
10
+ e = (0, _slash.slash)(n.replace(/\\/g, "/").replace(/\/$/, ""));
11
+ return r !== e && r.startsWith(`${e}/`);
12
12
  }
@@ -1 +1 @@
1
- import{formatSlash as t}from"./slash";export function isParentPath(o,a){const r=t(o),n=t(a);return t(r)!==t(n)&&t(r).startsWith(t(n))}
1
+ import{slash as t}from"./slash";export function isParentPath(a,n){const r=t(a.replace(/\\/g,"/").replace(/\/$/,"")),e=t(n.replace(/\\/g,"/").replace(/\/$/,""));return r!==e&&r.startsWith(`${e}/`)}
package/dist/replace.cjs CHANGED
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.replaceExtension = replaceExtension;
7
7
  exports.replacePath = replacePath;
8
- var _correctPath = require("./correct-path.cjs");
9
8
  var _cwd = require("./cwd.cjs");
10
9
  var _filePathFns = require("./file-path-fns.cjs");
11
10
  var _isParentPath = require("./is-parent-path.cjs");
12
11
  var _slash = require("./slash.cjs");
13
- function replacePath(r, o = (0, _cwd.cwd)()) {
14
- return (0, _slash.formatSlash)((0, _correctPath.correctPath)((0, _isParentPath.isParentPath)(r, o) ? (0, _slash.formatSlash)(r).replace((0, _slash.formatSlash)(o), "").replace(/^\/+/g, "") : r));
12
+ function replacePath(r, i = (0, _cwd.cwd)()) {
13
+ return (0, _isParentPath.isParentPath)(r, i) ? (0, _slash.slash)(r).replace((0, _slash.slash)(i), "").replace(/^\//, "") : r;
15
14
  }
16
- function replaceExtension(r, o = "") {
17
- return (0, _correctPath.correctPath)(r.replace(!o || o.includes(".") ? (0, _filePathFns.findFileDotExtensionSafe)(r) : (0, _filePathFns.findFileExtensionSafe)(r), o));
15
+ function replaceExtension(r, i = "") {
16
+ return r.replace(!i || i.includes(".") ? (0, _filePathFns.findFileDotExtensionSafe)(r) : (0, _filePathFns.findFileExtensionSafe)(r), i);
18
17
  }
package/dist/replace.mjs CHANGED
@@ -1 +1 @@
1
- import{correctPath as n}from"./correct-path";import{cwd as t}from"./cwd";import{findFileDotExtensionSafe as e,findFileExtensionSafe as f}from"./file-path-fns";import{isParentPath as s}from"./is-parent-path";import{formatSlash as i}from"./slash";export function replacePath(r,o=t()){return i(n(s(r,o)?i(r).replace(i(o),"").replace(/^\/+/g,""):r))}export function replaceExtension(r,o=""){return n(r.replace(!o||o.includes(".")?e(r):f(r),o))}
1
+ import{cwd as e}from"./cwd";import{findFileDotExtensionSafe as o,findFileExtensionSafe as t}from"./file-path-fns";import{isParentPath as s}from"./is-parent-path";import{slash as n}from"./slash";export function replacePath(r,i=e()){return s(r,i)?n(r).replace(n(i),"").replace(/^\//,""):r}export function replaceExtension(r,i=""){return r.replace(!i||i.includes(".")?o(r):t(r),i)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/path",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
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": {
@@ -294,5 +294,5 @@
294
294
  "main": "./dist/index.cjs",
295
295
  "module": "./dist/index.mjs",
296
296
  "types": "./dist/index.d.ts",
297
- "gitHead": "39c2e3311f9f1246241a55748436981aa65e3ced"
297
+ "gitHead": "b0eac1cfd7a0b0ff0a3ebe74aa6d6b5fc964a402"
298
298
  }