@twin.org/core 0.0.2-next.16 → 0.0.2-next.17

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.
@@ -398,26 +398,26 @@ class Is {
398
398
  */
399
399
  class StringHelper {
400
400
  /**
401
- * Trim trailing slashes from a string.
401
+ * Implementation signature for trimTrailingSlashes.
402
402
  * @param value The value to trim.
403
- * @returns The trimmed value.
403
+ * @returns The trimmed string or the original null/undefined.
404
404
  */
405
405
  static trimTrailingSlashes(value) {
406
- if (Is.stringValue(value)) {
406
+ if (Is.string(value)) {
407
407
  return value.replace(/\/+$/, "");
408
408
  }
409
- return "";
409
+ return value;
410
410
  }
411
411
  /**
412
- * Trim leading slashes from a string.
412
+ * Implementation signature for trimLeadingSlashes.
413
413
  * @param value The value to trim.
414
- * @returns The trimmed value.
414
+ * @returns The trimmed string or the original null/undefined.
415
415
  */
416
416
  static trimLeadingSlashes(value) {
417
- if (Is.stringValue(value)) {
417
+ if (Is.string(value)) {
418
418
  return value.replace(/^\/+/, "");
419
419
  }
420
- return "";
420
+ return value;
421
421
  }
422
422
  /**
423
423
  * Convert the input string to kebab case.
@@ -2705,7 +2705,7 @@ class ObjectHelper {
2705
2705
  * @returns The object as bytes.
2706
2706
  */
2707
2707
  static toBytes(obj, format = false) {
2708
- if (obj === undefined) {
2708
+ if (Is.undefined(obj)) {
2709
2709
  return new Uint8Array();
2710
2710
  }
2711
2711
  const json = format ? JSON.stringify(obj, undefined, "\t") : JSON.stringify(obj);
@@ -396,26 +396,26 @@ class Is {
396
396
  */
397
397
  class StringHelper {
398
398
  /**
399
- * Trim trailing slashes from a string.
399
+ * Implementation signature for trimTrailingSlashes.
400
400
  * @param value The value to trim.
401
- * @returns The trimmed value.
401
+ * @returns The trimmed string or the original null/undefined.
402
402
  */
403
403
  static trimTrailingSlashes(value) {
404
- if (Is.stringValue(value)) {
404
+ if (Is.string(value)) {
405
405
  return value.replace(/\/+$/, "");
406
406
  }
407
- return "";
407
+ return value;
408
408
  }
409
409
  /**
410
- * Trim leading slashes from a string.
410
+ * Implementation signature for trimLeadingSlashes.
411
411
  * @param value The value to trim.
412
- * @returns The trimmed value.
412
+ * @returns The trimmed string or the original null/undefined.
413
413
  */
414
414
  static trimLeadingSlashes(value) {
415
- if (Is.stringValue(value)) {
415
+ if (Is.string(value)) {
416
416
  return value.replace(/^\/+/, "");
417
417
  }
418
- return "";
418
+ return value;
419
419
  }
420
420
  /**
421
421
  * Convert the input string to kebab case.
@@ -2703,7 +2703,7 @@ class ObjectHelper {
2703
2703
  * @returns The object as bytes.
2704
2704
  */
2705
2705
  static toBytes(obj, format = false) {
2706
- if (obj === undefined) {
2706
+ if (Is.undefined(obj)) {
2707
2707
  return new Uint8Array();
2708
2708
  }
2709
2709
  const json = format ? JSON.stringify(obj, undefined, "\t") : JSON.stringify(obj);
@@ -4,16 +4,28 @@
4
4
  export declare class StringHelper {
5
5
  /**
6
6
  * Trim trailing slashes from a string.
7
+ * Overloads preserve null/undefined instead of coercing to empty string.
7
8
  * @param value The value to trim.
8
- * @returns The trimmed value.
9
+ * @returns The trimmed value (same null/undefined passed in).
9
10
  */
10
- static trimTrailingSlashes(value: string | undefined): string;
11
+ static trimTrailingSlashes(value: string): string;
12
+ /**
13
+ *
14
+ * @param value
15
+ */
16
+ static trimTrailingSlashes<T extends null | undefined>(value: T): T;
11
17
  /**
12
18
  * Trim leading slashes from a string.
19
+ * Overloads preserve null/undefined instead of coercing to empty string.
13
20
  * @param value The value to trim.
14
- * @returns The trimmed value.
21
+ * @returns The trimmed value (same null/undefined passed in).
22
+ */
23
+ static trimLeadingSlashes(value: string): string;
24
+ /**
25
+ * Overload for null/undefined passthrough.
26
+ * @param value The null or undefined value.
15
27
  */
16
- static trimLeadingSlashes(value: string | undefined): string;
28
+ static trimLeadingSlashes<T extends null | undefined>(value: T): T;
17
29
  /**
18
30
  * Convert the input string to kebab case.
19
31
  * @param input The input to convert.
package/docs/changelog.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @twin.org/core - Changelog
2
2
 
3
+ ## [0.0.2-next.17](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.16...core-v0.0.2-next.17) (2025-09-29)
4
+
5
+
6
+ ### Features
7
+
8
+ * additional nameof operators ([a5aab60](https://github.com/twinfoundation/framework/commit/a5aab60bf66a86f1b7ff8af7c4f044cb03706d50))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nameof bumped from 0.0.2-next.16 to 0.0.2-next.17
16
+ * devDependencies
17
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.16 to 0.0.2-next.17
18
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.16 to 0.0.2-next.17
19
+
3
20
  ## [0.0.2-next.16](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.15...core-v0.0.2-next.16) (2025-09-28)
4
21
 
5
22
 
@@ -16,45 +16,107 @@ Class to help with string.
16
16
 
17
17
  ### trimTrailingSlashes()
18
18
 
19
+ Implementation signature for trimTrailingSlashes.
20
+
21
+ #### Param
22
+
23
+ The value to trim.
24
+
25
+ #### Call Signature
26
+
19
27
  > `static` **trimTrailingSlashes**(`value`): `string`
20
28
 
21
29
  Trim trailing slashes from a string.
30
+ Overloads preserve null/undefined instead of coercing to empty string.
22
31
 
23
- #### Parameters
32
+ ##### Parameters
24
33
 
25
- ##### value
34
+ ###### value
35
+
36
+ `string`
26
37
 
27
38
  The value to trim.
28
39
 
29
- `undefined` | `string`
30
-
31
- #### Returns
40
+ ##### Returns
32
41
 
33
42
  `string`
34
43
 
35
- The trimmed value.
44
+ The trimmed value (same null/undefined passed in).
45
+
46
+ #### Call Signature
47
+
48
+ > `static` **trimTrailingSlashes**\<`T`\>(`value`): `T`
49
+
50
+ ##### Type Parameters
51
+
52
+ ###### T
53
+
54
+ `T` *extends* `undefined` \| `null`
55
+
56
+ ##### Parameters
57
+
58
+ ###### value
59
+
60
+ `T`
61
+
62
+ ##### Returns
63
+
64
+ `T`
36
65
 
37
66
  ***
38
67
 
39
68
  ### trimLeadingSlashes()
40
69
 
70
+ Implementation signature for trimLeadingSlashes.
71
+
72
+ #### Param
73
+
74
+ The value to trim.
75
+
76
+ #### Call Signature
77
+
41
78
  > `static` **trimLeadingSlashes**(`value`): `string`
42
79
 
43
80
  Trim leading slashes from a string.
81
+ Overloads preserve null/undefined instead of coercing to empty string.
44
82
 
45
- #### Parameters
83
+ ##### Parameters
46
84
 
47
- ##### value
85
+ ###### value
48
86
 
49
- The value to trim.
87
+ `string`
50
88
 
51
- `undefined` | `string`
89
+ The value to trim.
52
90
 
53
- #### Returns
91
+ ##### Returns
54
92
 
55
93
  `string`
56
94
 
57
- The trimmed value.
95
+ The trimmed value (same null/undefined passed in).
96
+
97
+ #### Call Signature
98
+
99
+ > `static` **trimLeadingSlashes**\<`T`\>(`value`): `T`
100
+
101
+ Overload for null/undefined passthrough.
102
+
103
+ ##### Type Parameters
104
+
105
+ ###### T
106
+
107
+ `T` *extends* `undefined` \| `null`
108
+
109
+ ##### Parameters
110
+
111
+ ###### value
112
+
113
+ `T`
114
+
115
+ The null or undefined value.
116
+
117
+ ##### Returns
118
+
119
+ `T`
58
120
 
59
121
  ***
60
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/core",
3
- "version": "0.0.2-next.16",
3
+ "version": "0.0.2-next.17",
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.2-next.16",
17
+ "@twin.org/nameof": "0.0.2-next.17",
18
18
  "intl-messageformat": "10.7.16",
19
19
  "rfc6902": "5.1.2"
20
20
  },