@mangos/filepath 1.0.7 → 1.0.8
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 +6 -1
- package/dist/Token.d.ts +4 -0
- package/dist/Token.js +12 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,7 +149,12 @@ class PathToken {
|
|
|
149
149
|
value: string; // actual path fragment (directory, seperator, or file)
|
|
150
150
|
start: number; // start location in the original string
|
|
151
151
|
end: number; // end (inclusive) in the original string
|
|
152
|
-
|
|
152
|
+
error?: string; // this token has invalid character for the OS selected
|
|
153
|
+
isRoot(): boolean; // is this token a Root Token (c:/, /, //?/UNC/Server/share, etc)
|
|
154
|
+
isPathElement(): boolean; // a normal path element
|
|
155
|
+
isCurrent(): boolean; // token representing "./"
|
|
156
|
+
isParent(): boolean // token representing "../"
|
|
157
|
+
isSeperator(): boolean // token representing "/" (posix) or "\" (windows, dos)
|
|
153
158
|
}
|
|
154
159
|
```
|
|
155
160
|
|
package/dist/Token.d.ts
CHANGED
|
@@ -14,5 +14,9 @@ export declare class PathToken {
|
|
|
14
14
|
readonly error?: string;
|
|
15
15
|
constructor(token: PathTokenValueType, value: string, start: number, end: number, error?: string);
|
|
16
16
|
isRoot(): boolean;
|
|
17
|
+
isSeparator(): boolean;
|
|
18
|
+
isPathElement(): boolean;
|
|
19
|
+
isCurrent(): boolean;
|
|
20
|
+
isParent(): boolean;
|
|
17
21
|
equals(ot: PathToken): boolean;
|
|
18
22
|
}
|
package/dist/Token.js
CHANGED
|
@@ -16,6 +16,18 @@ class PathToken {
|
|
|
16
16
|
isRoot() {
|
|
17
17
|
return this.token === PathTokenEnum.ROOT;
|
|
18
18
|
}
|
|
19
|
+
isSeparator() {
|
|
20
|
+
return this.token === PathTokenEnum.SEP;
|
|
21
|
+
}
|
|
22
|
+
isPathElement() {
|
|
23
|
+
return this.token === PathTokenEnum.PATHELT;
|
|
24
|
+
}
|
|
25
|
+
isCurrent() {
|
|
26
|
+
return this.token === PathTokenEnum.CURRENT;
|
|
27
|
+
}
|
|
28
|
+
isParent() {
|
|
29
|
+
return this.token === PathTokenEnum.PARENT;
|
|
30
|
+
}
|
|
19
31
|
equals(ot) {
|
|
20
32
|
return ot.token === this.token && ot.value === this.value && ot.error === this.error;
|
|
21
33
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PathTokenEnum } from './constants.js';
|
|
|
2
2
|
import { ParsedPath } from './ParsedPath.js';
|
|
3
3
|
import { ParsedPathError } from './ParsedPathError.js';
|
|
4
4
|
import { allPath, firstPath, resolve, resolvePathObject } from './parser.js';
|
|
5
|
-
import
|
|
5
|
+
import { PathToken } from './Token.js';
|
|
6
6
|
import type { PathTokenValueType } from './types/TokenValueType.js';
|
|
7
|
-
export { resolve, firstPath, allPath, ParsedPath, ParsedPathError, resolvePathObject, PathTokenEnum };
|
|
8
|
-
export type { PathTokenValueType
|
|
7
|
+
export { resolve, firstPath, allPath, ParsedPath, ParsedPathError, PathToken, resolvePathObject, PathTokenEnum };
|
|
8
|
+
export type { PathTokenValueType };
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import { PathTokenEnum } from "./constants.js";
|
|
|
2
2
|
import { ParsedPath } from "./ParsedPath.js";
|
|
3
3
|
import { ParsedPathError } from "./ParsedPathError.js";
|
|
4
4
|
import { allPath, firstPath, resolve, resolvePathObject } from "./parser.js";
|
|
5
|
+
import { PathToken } from "./Token.js";
|
|
5
6
|
export {
|
|
6
7
|
ParsedPath,
|
|
7
8
|
ParsedPathError,
|
|
9
|
+
PathToken,
|
|
8
10
|
PathTokenEnum,
|
|
9
11
|
allPath,
|
|
10
12
|
firstPath,
|