@stryke/path 0.15.0 → 0.15.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/dist/append.cjs CHANGED
@@ -3,11 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.append = void 0;
6
7
  exports.appendPath = appendPath;
7
8
  var _cwd = require("./cwd.cjs");
8
9
  var _isParentPath = require("./is-parent-path.cjs");
9
10
  var _joinPaths = require("./join-paths.cjs");
10
11
  var _slash = require("./slash.cjs");
11
12
  function appendPath(r, o = (0, _cwd.cwd)()) {
12
- return (0, _slash.slash)((0, _isParentPath.isParentPath)(r, o) ? (0, _joinPaths.joinPaths)(r, o) : r);
13
- }
13
+ return (0, _slash.slash)((0, _isParentPath.isParentPath)(r, o) ? r : (0, _joinPaths.joinPaths)(o, r));
14
+ }
15
+ const append = exports.append = appendPath;
package/dist/append.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  /**
2
- * Append the base path from the beginning of the given path.
2
+ * If not already a parent path, append the base path from the beginning of the given child path.
3
3
  *
4
4
  * @example
5
5
  * ```ts
6
- * appendPath("/home/user/project/src/index.ts", "/home/user/project");
7
- * // returns "src/index.ts"
6
+ * appendPath("src/index.ts", "/home/user/project");
7
+ * // returns "/home/user/project/src/index.ts"
8
+ *
9
+ * appendPath("/user/dev/app.ts", "/user/dev");
10
+ * // returns "/user/dev/app.ts"
8
11
  * ```
9
12
  *
10
13
  * @param childPath - The child path to append to the {@link parentPath}
@@ -12,3 +15,4 @@
12
15
  * @returns The {@link parentPath} with the {@link childPath} appended
13
16
  */
14
17
  export declare function appendPath(childPath: string, parentPath?: string): string;
18
+ export declare const append: typeof appendPath;
package/dist/append.mjs CHANGED
@@ -1 +1 @@
1
- import{cwd as t}from"./cwd";import{isParentPath as i}from"./is-parent-path";import{joinPaths as m}from"./join-paths";import{slash as n}from"./slash";export function appendPath(r,o=t()){return n(i(r,o)?m(r,o):r)}
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/path",
3
- "version": "0.15.0",
3
+ "version": "0.15.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": {
@@ -278,5 +278,5 @@
278
278
  "main": "./dist/index.cjs",
279
279
  "module": "./dist/index.mjs",
280
280
  "types": "./dist/index.d.ts",
281
- "gitHead": "4074c4a56f6e2c42ca4c39c30df5309c19024c7b"
281
+ "gitHead": "e16d8342cedeaa690117587b41cfc439b61b38bb"
282
282
  }