@twin.org/core 0.9.0 → 0.9.1-next.10

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.
@@ -156,7 +156,7 @@ The urn with a prefix.
156
156
 
157
157
  ### guard() {#guard}
158
158
 
159
- > `static` **guard**(`source`, `property`, `value`): `asserts value is string`
159
+ > `static` **guard**(`source`, `property`, `value`, `options?`): `asserts value is string`
160
160
 
161
161
  Parse a string into the urn parts.
162
162
 
@@ -180,6 +180,22 @@ The name of the property.
180
180
 
181
181
  The urn to parse.
182
182
 
183
+ ##### options?
184
+
185
+ Optional constraints to validate the urn namespace identifier and specific parts.
186
+
187
+ ###### namespaceIdentifier?
188
+
189
+ `string`
190
+
191
+ The namespace identifier the urn must match.
192
+
193
+ ###### namespaceSpecific?
194
+
195
+ `string` \| `string`[]
196
+
197
+ The namespace specific part(s) the urn must match.
198
+
183
199
  #### Returns
184
200
 
185
201
  `asserts value is string`
@@ -282,7 +298,7 @@ The namespace method.
282
298
 
283
299
  ### namespaceSpecificParts() {#namespacespecificparts}
284
300
 
285
- > **namespaceSpecificParts**(`startIndex?`): `string`[]
301
+ > **namespaceSpecificParts**(`startIndex?`, `count?`): `string`[]
286
302
 
287
303
  Get the namespace specific parts.
288
304
 
@@ -294,6 +310,12 @@ Get the namespace specific parts.
294
310
 
295
311
  The index to start from, defaults to 0.
296
312
 
313
+ ##### count?
314
+
315
+ `number`
316
+
317
+ The number of parts to return, defaults to all remaining parts.
318
+
297
319
  #### Returns
298
320
 
299
321
  `string`[]
package/locales/en.json CHANGED
@@ -71,6 +71,8 @@
71
71
  "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
72
72
  "function": "Property \"{property}\" must be a function, it is \"{value}\"",
73
73
  "urn": "Property \"{property}\" must be a URN formatted string, it is \"{value}\"",
74
+ "urnNamespaceIdentifier": "Property \"{property}\" must be a URN with namespace identifier \"{options}\", it is \"{value}\"",
75
+ "urnNamespaceSpecific": "Property \"{property}\" must be a URN with namespace specific \"{options}\", it is \"{value}\"",
74
76
  "url": "Property \"{property}\" must be a URL formatted string, it is \"{value}\"",
75
77
  "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
76
78
  "uuidV7": "Property \"{property}\" must be a UUIDv7 formatted string, it is \"{value}\"",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/core",
3
- "version": "0.9.0",
3
+ "version": "0.9.1-next.10",
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.9.0",
17
+ "@twin.org/nameof": "0.9.1-next.10",
18
18
  "intl-messageformat": "11.2.8",
19
19
  "rfc6902": "5.2.0"
20
20
  },