Commit b257676
authored
🩹 [Patch]: Ensure all other value types is converted to string in
## Description
This pull request includes several key improvements and bug fixes to the
`Format-Hashtable` function.
Enhancements to data type handling:
* Improved handling of `PSCustomObject` by converting it to a hashtable
and recursively formatting it.
* Added support for `SwitchParameter` type alongside `bool`, ensuring
proper conversion and formatting.
* Enhanced handling of numeric types by including `long` and `decimal`
in addition to `int` and `double`.
* Refined array handling to support any `IList` implementation, covering
normal arrays, `ArrayList`, `List<T>`, etc.
Code readability improvements:
* Added comments to explain the purpose of specific code blocks, such as
nested hashtable handling and fallback string escaping.
* Streamlined `foreach` loop for array elements, improving verbosity and
element processing.
## Type of change
<!-- Use the check-boxes [x] on the options that are relevant. -->
- [ ] 📖 [Docs]
- [ ] 🪲 [Fix]
- [x] 🩹 [Patch]
- [ ] Format-Hashtable (#12)1 parent 6bab12d commit b257676
2 files changed
Lines changed: 58 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
| 110 | + | |
110 | 111 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
121 | 128 | | |
122 | 129 | | |
123 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
124 | 133 | | |
125 | 134 | | |
126 | | - | |
127 | | - | |
| 135 | + | |
| 136 | + | |
128 | 137 | | |
129 | 138 | | |
130 | | - | |
131 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
132 | 142 | | |
133 | 143 | | |
| 144 | + | |
134 | 145 | | |
135 | 146 | | |
| 147 | + | |
136 | 148 | | |
137 | 149 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | | - | |
418 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
419 | 427 | | |
420 | 428 | | |
421 | 429 | | |
| |||
429 | 437 | | |
430 | 438 | | |
431 | 439 | | |
432 | | - | |
| 440 | + | |
433 | 441 | | |
434 | 442 | | |
435 | 443 | | |
| |||
479 | 487 | | |
480 | 488 | | |
481 | 489 | | |
482 | | - | |
483 | | - | |
484 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
485 | 501 | | |
486 | 502 | | |
487 | 503 | | |
| |||
494 | 510 | | |
495 | 511 | | |
496 | 512 | | |
| 513 | + | |
497 | 514 | | |
498 | 515 | | |
499 | 516 | | |
| |||
0 commit comments