@mangos/filepath 1.0.6 → 1.0.7

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/README.md CHANGED
@@ -64,7 +64,19 @@ import { allPath, firstPath, resolve, resolvePathObject } from '@mangos/filepath
64
64
  There are 2 exported classes:
65
65
 
66
66
  ```typescript
67
- import { ParsedPath, ParsedPathError } from '@mangos/filepath';
67
+ import { ParsedPath, ParsedPathError, PathToken } from '@mangos/filepath';
68
+ ```
69
+
70
+ There is 1 exported enum:
71
+
72
+ ```typescript
73
+ import { PathTokenEnum } from '@mangos/filepath'
74
+ ```
75
+
76
+ There is 1 exported type:
77
+
78
+ ```typescript
79
+ import type { InferPathOptions } from '@mangos/filepath'
68
80
  ```
69
81
 
70
82
  Most of the time you will be using <a href="#fn-resolve"><code>resolve</code></a>, <a href="#fn-first-path"><code>firstPath</code></a>.
@@ -127,6 +139,32 @@ When a string is parsed it will be evaluated according to path types in the foll
127
139
  3. `dos` tokanization will be tried third, (if the `dos` boolean is set to true).
128
140
  4. `posix` tokanization will be tried forth, (if the `posix` boolean is set to true)
129
141
 
142
+ <h3 id="path-token-type"><code>PathToken</code> object</h3>
143
+
144
+ You dont create `PathToken`s yourself the api will do it for you.
145
+
146
+ ```typescript
147
+ class PathToken {
148
+ token: PathTokenValueType;
149
+ value: string; // actual path fragment (directory, seperator, or file)
150
+ start: number; // start location in the original string
151
+ end: number; // end (inclusive) in the original string
152
+ error?: string; // this token has invalid character for the OS selected
153
+ }
154
+ ```
155
+
156
+ The `PathTokenValueType` match the exported `PathTokenEnum` object
157
+
158
+ ```typescript
159
+ export const PathTokenEnum = {
160
+ SEP: '\x01', // path seperator
161
+ ROOT: '\x03', // the root (if it is an absolute path)
162
+ PATHELT: '\x06', // directory, file,
163
+ PARENT: '\x07', // two dots (..) meaning parent directory
164
+ CURRENT: '\x08', // a single dot (.) meaning current directory
165
+ } as const;
166
+ ```
167
+
130
168
  <h3 id="api-functions">Functions</h3>
131
169
 
132
170
  <h4 id="fn-all-path">function: <code>allPath</code></h4>
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { PathTokenEnum } from './constants.js';
1
2
  import { ParsedPath } from './ParsedPath.js';
2
3
  import { ParsedPathError } from './ParsedPathError.js';
3
4
  import { allPath, firstPath, resolve, resolvePathObject } from './parser.js';
4
5
  import type { PathToken } from './Token.js';
5
6
  import type { PathTokenValueType } from './types/TokenValueType.js';
6
- export { resolve, firstPath, allPath, ParsedPath, ParsedPathError, resolvePathObject };
7
+ export { resolve, firstPath, allPath, ParsedPath, ParsedPathError, resolvePathObject, PathTokenEnum };
7
8
  export type { PathTokenValueType, PathToken };
package/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
+ import { PathTokenEnum } from "./constants.js";
1
2
  import { ParsedPath } from "./ParsedPath.js";
2
3
  import { ParsedPathError } from "./ParsedPathError.js";
3
4
  import { allPath, firstPath, resolve, resolvePathObject } from "./parser.js";
4
5
  export {
5
6
  ParsedPath,
6
7
  ParsedPathError,
8
+ PathTokenEnum,
7
9
  allPath,
8
10
  firstPath,
9
11
  resolve,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mangos/filepath",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "author": "jacob bogers <jkfbogers@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",