@twin.org/core 0.0.3-next.2 → 0.0.3-next.21
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/es/factories/factory.js +54 -1
- package/dist/es/factories/factory.js.map +1 -1
- package/dist/es/helpers/randomHelper.js +50 -2
- package/dist/es/helpers/randomHelper.js.map +1 -1
- package/dist/es/types/urn.js +1 -2
- package/dist/es/types/urn.js.map +1 -1
- package/dist/es/utils/guards.js +16 -0
- package/dist/es/utils/guards.js.map +1 -1
- package/dist/es/utils/is.js +16 -0
- package/dist/es/utils/is.js.map +1 -1
- package/dist/types/factories/factory.d.ts +27 -1
- package/dist/types/helpers/randomHelper.d.ts +16 -0
- package/dist/types/utils/guards.d.ts +9 -0
- package/dist/types/utils/is.d.ts +7 -0
- package/docs/changelog.md +386 -0
- package/docs/reference/classes/Factory.md +106 -2
- package/docs/reference/classes/Guards.md +42 -0
- package/docs/reference/classes/Is.md +28 -0
- package/docs/reference/classes/RandomHelper.md +52 -0
- package/locales/en.json +5 -2
- package/package.json +2 -2
|
@@ -853,3 +853,31 @@ The object to check.
|
|
|
853
853
|
`obj is (args: any[]) => T`
|
|
854
854
|
|
|
855
855
|
True if the object is a class, false otherwise.
|
|
856
|
+
|
|
857
|
+
***
|
|
858
|
+
|
|
859
|
+
### uuidV7()
|
|
860
|
+
|
|
861
|
+
> `static` **uuidV7**(`value`, `format?`): `value is string`
|
|
862
|
+
|
|
863
|
+
Is the value a uuidV7 string.
|
|
864
|
+
|
|
865
|
+
#### Parameters
|
|
866
|
+
|
|
867
|
+
##### value
|
|
868
|
+
|
|
869
|
+
`unknown`
|
|
870
|
+
|
|
871
|
+
The value to test.
|
|
872
|
+
|
|
873
|
+
##### format?
|
|
874
|
+
|
|
875
|
+
The format of the UUIDv7 string.
|
|
876
|
+
|
|
877
|
+
`"standard"` | `"compact"`
|
|
878
|
+
|
|
879
|
+
#### Returns
|
|
880
|
+
|
|
881
|
+
`value is string`
|
|
882
|
+
|
|
883
|
+
True if the value is a uuidV7 string.
|
|
@@ -12,6 +12,14 @@ Class to help with random generation.
|
|
|
12
12
|
|
|
13
13
|
`RandomHelper`
|
|
14
14
|
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
25
|
### generate()
|
|
@@ -33,3 +41,47 @@ The length of buffer to create.
|
|
|
33
41
|
`Uint8Array`
|
|
34
42
|
|
|
35
43
|
The random array.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### generateUuidV7()
|
|
48
|
+
|
|
49
|
+
> `static` **generateUuidV7**(`format`): `string`
|
|
50
|
+
|
|
51
|
+
Generate a new UUIDv7.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### format
|
|
56
|
+
|
|
57
|
+
The format of the UUIDv7 string.
|
|
58
|
+
|
|
59
|
+
`"standard"` | `"compact"`
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
`string`
|
|
64
|
+
|
|
65
|
+
The UUIDv7 string.
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### uuidV7ExtractTimestamp()
|
|
70
|
+
|
|
71
|
+
> `static` **uuidV7ExtractTimestamp**(`uuid`): `number`
|
|
72
|
+
|
|
73
|
+
Extract the unix timestamp (ms) from a UUIDv7.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
##### uuid
|
|
78
|
+
|
|
79
|
+
`string`
|
|
80
|
+
|
|
81
|
+
The UUIDv7 string.
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`number`
|
|
86
|
+
|
|
87
|
+
The unix timestamp in milliseconds.
|
package/locales/en.json
CHANGED
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
"function": "Property \"{property}\" must be a function, it is \"{value}\"",
|
|
70
70
|
"urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
|
|
71
71
|
"url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
|
|
72
|
-
"email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\""
|
|
72
|
+
"email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
|
|
73
|
+
"uuidV7": "Property \"{property}\" must be a UUIDv7 formatted string, it is \"{value}\"",
|
|
74
|
+
"uuidV7Compact": "Property \"{property}\" must be a UUIDv7 formatted string in compact mode, it is \"{value}\""
|
|
73
75
|
},
|
|
74
76
|
"objectHelper": {
|
|
75
77
|
"failedBytesToJSON": "Failed converting bytes to JSON",
|
|
@@ -82,7 +84,8 @@
|
|
|
82
84
|
},
|
|
83
85
|
"factory": {
|
|
84
86
|
"noUnregister": "There is no {typeName} registered with the name \"{name}\"",
|
|
85
|
-
"noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
|
|
87
|
+
"noGet": "The requested {typeName} \"{name}\" does not exist in the factory",
|
|
88
|
+
"noCreate": "The requested {typeName} \"{name}\" cannot be created by the factory, with params \"{params}\""
|
|
86
89
|
},
|
|
87
90
|
"bitString": {
|
|
88
91
|
"outOfRange": "The index should be >= 0 and less than the length of the bit string, the index is \"{index}\" and the number of bit is \"{numberBits}\""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.21",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/nameof": "0.0.3-next.
|
|
17
|
+
"@twin.org/nameof": "0.0.3-next.21",
|
|
18
18
|
"intl-messageformat": "10.7.18",
|
|
19
19
|
"rfc6902": "5.1.2"
|
|
20
20
|
},
|