@bgord/tools 0.12.14 → 0.12.15
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/file-path.vo.d.ts +12 -12
- package/dist/file-path.vo.js +12 -12
- package/package.json +1 -1
- package/src/file-path.vo.ts +18 -18
package/dist/file-path.vo.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { type DirectoryPathAbsoluteType } from "./directory-path-absolute.vo";
|
|
2
2
|
import { type DirectoryPathRelativeType } from "./directory-path-relative.vo";
|
|
3
3
|
import type { Filename } from "./filename.vo";
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class FilePathRelative {
|
|
5
5
|
private readonly directory;
|
|
6
6
|
private readonly filename;
|
|
7
7
|
private constructor();
|
|
8
|
-
static fromParts(directoryCandidate: string, filename: Filename):
|
|
9
|
-
static fromPartsSafe(directory: DirectoryPathRelativeType, filename: Filename):
|
|
8
|
+
static fromParts(directoryCandidate: string, filename: Filename): FilePathRelative;
|
|
9
|
+
static fromPartsSafe(directory: DirectoryPathRelativeType, filename: Filename): FilePathRelative;
|
|
10
10
|
get(): string;
|
|
11
11
|
getDirectory(): DirectoryPathRelativeType;
|
|
12
12
|
getFilename(): Filename;
|
|
13
|
-
withDirectoryRelative(newDirectory: DirectoryPathRelativeType):
|
|
14
|
-
withFilename(newFilename: Filename):
|
|
15
|
-
toAbsolute(newDirectory: DirectoryPathAbsoluteType):
|
|
13
|
+
withDirectoryRelative(newDirectory: DirectoryPathRelativeType): FilePathRelative;
|
|
14
|
+
withFilename(newFilename: Filename): FilePathRelative;
|
|
15
|
+
toAbsolute(newDirectory: DirectoryPathAbsoluteType): FilePathAbsolute;
|
|
16
16
|
}
|
|
17
|
-
export declare class
|
|
17
|
+
export declare class FilePathAbsolute {
|
|
18
18
|
private readonly directory;
|
|
19
19
|
private readonly filename;
|
|
20
20
|
private constructor();
|
|
21
|
-
static fromParts(directoryCandidate: string, filename: Filename):
|
|
22
|
-
static fromPartsSafe(directory: DirectoryPathAbsoluteType, filename: Filename):
|
|
21
|
+
static fromParts(directoryCandidate: string, filename: Filename): FilePathAbsolute;
|
|
22
|
+
static fromPartsSafe(directory: DirectoryPathAbsoluteType, filename: Filename): FilePathAbsolute;
|
|
23
23
|
get(): string;
|
|
24
24
|
getDirectory(): DirectoryPathAbsoluteType;
|
|
25
25
|
getFilename(): Filename;
|
|
26
|
-
withDirectoryAbsolute(newDirectory: DirectoryPathAbsoluteType):
|
|
27
|
-
withFilename(newFilename: Filename):
|
|
28
|
-
toRelative(newDirectory: DirectoryPathRelativeType):
|
|
26
|
+
withDirectoryAbsolute(newDirectory: DirectoryPathAbsoluteType): FilePathAbsolute;
|
|
27
|
+
withFilename(newFilename: Filename): FilePathAbsolute;
|
|
28
|
+
toRelative(newDirectory: DirectoryPathRelativeType): FilePathRelative;
|
|
29
29
|
}
|
package/dist/file-path.vo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DirectoryPathAbsoluteSchema } from "./directory-path-absolute.vo";
|
|
2
2
|
import { DirectoryPathRelativeSchema } from "./directory-path-relative.vo";
|
|
3
|
-
export class
|
|
3
|
+
export class FilePathRelative {
|
|
4
4
|
directory;
|
|
5
5
|
filename;
|
|
6
6
|
constructor(directory, filename) {
|
|
@@ -9,10 +9,10 @@ export class RelativeFilePath {
|
|
|
9
9
|
}
|
|
10
10
|
static fromParts(directoryCandidate, filename) {
|
|
11
11
|
const directory = DirectoryPathRelativeSchema.parse(directoryCandidate);
|
|
12
|
-
return new
|
|
12
|
+
return new FilePathRelative(directory, filename);
|
|
13
13
|
}
|
|
14
14
|
static fromPartsSafe(directory, filename) {
|
|
15
|
-
return new
|
|
15
|
+
return new FilePathRelative(directory, filename);
|
|
16
16
|
}
|
|
17
17
|
get() {
|
|
18
18
|
return `${this.directory}/${this.filename.get()}`;
|
|
@@ -24,16 +24,16 @@ export class RelativeFilePath {
|
|
|
24
24
|
return this.filename;
|
|
25
25
|
}
|
|
26
26
|
withDirectoryRelative(newDirectory) {
|
|
27
|
-
return new
|
|
27
|
+
return new FilePathRelative(newDirectory, this.filename);
|
|
28
28
|
}
|
|
29
29
|
withFilename(newFilename) {
|
|
30
|
-
return new
|
|
30
|
+
return new FilePathRelative(this.directory, newFilename);
|
|
31
31
|
}
|
|
32
32
|
toAbsolute(newDirectory) {
|
|
33
|
-
return
|
|
33
|
+
return FilePathAbsolute.fromPartsSafe(newDirectory, this.filename);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
export class
|
|
36
|
+
export class FilePathAbsolute {
|
|
37
37
|
directory;
|
|
38
38
|
filename;
|
|
39
39
|
constructor(directory, filename) {
|
|
@@ -42,10 +42,10 @@ export class AbsoluteFilePath {
|
|
|
42
42
|
}
|
|
43
43
|
static fromParts(directoryCandidate, filename) {
|
|
44
44
|
const directory = DirectoryPathAbsoluteSchema.parse(directoryCandidate);
|
|
45
|
-
return new
|
|
45
|
+
return new FilePathAbsolute(directory, filename);
|
|
46
46
|
}
|
|
47
47
|
static fromPartsSafe(directory, filename) {
|
|
48
|
-
return new
|
|
48
|
+
return new FilePathAbsolute(directory, filename);
|
|
49
49
|
}
|
|
50
50
|
get() {
|
|
51
51
|
if (this.directory === "/")
|
|
@@ -59,12 +59,12 @@ export class AbsoluteFilePath {
|
|
|
59
59
|
return this.filename;
|
|
60
60
|
}
|
|
61
61
|
withDirectoryAbsolute(newDirectory) {
|
|
62
|
-
return new
|
|
62
|
+
return new FilePathAbsolute(newDirectory, this.filename);
|
|
63
63
|
}
|
|
64
64
|
withFilename(newFilename) {
|
|
65
|
-
return new
|
|
65
|
+
return new FilePathAbsolute(this.directory, newFilename);
|
|
66
66
|
}
|
|
67
67
|
toRelative(newDirectory) {
|
|
68
|
-
return
|
|
68
|
+
return FilePathRelative.fromPartsSafe(newDirectory, this.filename);
|
|
69
69
|
}
|
|
70
70
|
}
|
package/package.json
CHANGED
package/src/file-path.vo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DirectoryPathAbsoluteSchema, type DirectoryPathAbsoluteType } from "./d
|
|
|
2
2
|
import { DirectoryPathRelativeSchema, type DirectoryPathRelativeType } from "./directory-path-relative.vo";
|
|
3
3
|
import type { Filename } from "./filename.vo";
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class FilePathRelative {
|
|
6
6
|
private constructor(
|
|
7
7
|
private readonly directory: DirectoryPathRelativeType,
|
|
8
8
|
private readonly filename: Filename,
|
|
@@ -10,11 +10,11 @@ export class RelativeFilePath {
|
|
|
10
10
|
|
|
11
11
|
static fromParts(directoryCandidate: string, filename: Filename) {
|
|
12
12
|
const directory = DirectoryPathRelativeSchema.parse(directoryCandidate);
|
|
13
|
-
return new
|
|
13
|
+
return new FilePathRelative(directory, filename);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static fromPartsSafe(directory: DirectoryPathRelativeType, filename: Filename) {
|
|
17
|
-
return new
|
|
17
|
+
return new FilePathRelative(directory, filename);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
get() {
|
|
@@ -29,20 +29,20 @@ export class RelativeFilePath {
|
|
|
29
29
|
return this.filename;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
withDirectoryRelative(newDirectory: DirectoryPathRelativeType):
|
|
33
|
-
return new
|
|
32
|
+
withDirectoryRelative(newDirectory: DirectoryPathRelativeType): FilePathRelative {
|
|
33
|
+
return new FilePathRelative(newDirectory, this.filename);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
withFilename(newFilename: Filename):
|
|
37
|
-
return new
|
|
36
|
+
withFilename(newFilename: Filename): FilePathRelative {
|
|
37
|
+
return new FilePathRelative(this.directory, newFilename);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
toAbsolute(newDirectory: DirectoryPathAbsoluteType):
|
|
41
|
-
return
|
|
40
|
+
toAbsolute(newDirectory: DirectoryPathAbsoluteType): FilePathAbsolute {
|
|
41
|
+
return FilePathAbsolute.fromPartsSafe(newDirectory, this.filename);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export class
|
|
45
|
+
export class FilePathAbsolute {
|
|
46
46
|
private constructor(
|
|
47
47
|
private readonly directory: DirectoryPathAbsoluteType,
|
|
48
48
|
private readonly filename: Filename,
|
|
@@ -50,11 +50,11 @@ export class AbsoluteFilePath {
|
|
|
50
50
|
|
|
51
51
|
static fromParts(directoryCandidate: string, filename: Filename) {
|
|
52
52
|
const directory = DirectoryPathAbsoluteSchema.parse(directoryCandidate);
|
|
53
|
-
return new
|
|
53
|
+
return new FilePathAbsolute(directory, filename);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
static fromPartsSafe(directory: DirectoryPathAbsoluteType, filename: Filename) {
|
|
57
|
-
return new
|
|
57
|
+
return new FilePathAbsolute(directory, filename);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
get() {
|
|
@@ -70,15 +70,15 @@ export class AbsoluteFilePath {
|
|
|
70
70
|
return this.filename;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
withDirectoryAbsolute(newDirectory: DirectoryPathAbsoluteType):
|
|
74
|
-
return new
|
|
73
|
+
withDirectoryAbsolute(newDirectory: DirectoryPathAbsoluteType): FilePathAbsolute {
|
|
74
|
+
return new FilePathAbsolute(newDirectory, this.filename);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
withFilename(newFilename: Filename):
|
|
78
|
-
return new
|
|
77
|
+
withFilename(newFilename: Filename): FilePathAbsolute {
|
|
78
|
+
return new FilePathAbsolute(this.directory, newFilename);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
toRelative(newDirectory: DirectoryPathRelativeType):
|
|
82
|
-
return
|
|
81
|
+
toRelative(newDirectory: DirectoryPathRelativeType): FilePathRelative {
|
|
82
|
+
return FilePathRelative.fromPartsSafe(newDirectory, this.filename);
|
|
83
83
|
}
|
|
84
84
|
}
|