MergeHashtable
0.0.4
Apteco PS Modules - PowerShell merge Hashtable
This module merges two hashtables into one. It is able to handle nested structures like hashtables, arrays and PSCustomObjects. Please see the examples below.
Just use
```PowerShell
$left = [hashtable]@{
"firstname" = "Florian"
"lastname" = "Friedrichs"
"address" = [hashtable]@{
"Street"
This module merges two hashtables into one. It is able to handle nested structures like hashtables, arrays and PSCustomObjects. Please see the examples below.
Just use
```PowerShell
$left = [hashtable]@{
"firstname" = "Florian"
"lastname" = "Friedrichs"
"address" = [hashtable]@{
"Street"
Apteco PS Modules - PowerShell merge Hashtable
This module merges two hashtables into one. It is able to handle nested structures like hashtables, arrays and PSCustomObjects. Please see the examples below.
Just use
```PowerShell
$left = [hashtable]@{
"firstname" = "Florian"
"lastname" = "Friedrichs"
"address" = [hashtable]@{
"Street" = "Kaiserstraße 35"
}
"tags" = [Array]@("nice","company")
"product" = [PSCustomObject]@{
"name" = "Orbit"
"owner" = "Apteco Ltd."
}
}
$right = [hashtable]@{
"lastname" = "von Bracht"
"Street" = "Schaumainkai 87"
"address" = [hashtable]@{
"Street" = "Schaumainkai 87"
"Postcode" = 60596
}
"tags" = [Array]@("wow")
"product" = [PSCustomObject]@{
"sprint" = 106
}
}
Merge-Hashtable -Left $left -right $right -AddKeysFromRight -MergeArrays -MergePSCustomObjects -MergeHashtables
```
to merge two nested hashtables into one where the "right" will overwrite existing values from "left".
Show more
This module merges two hashtables into one. It is able to handle nested structures like hashtables, arrays and PSCustomObjects. Please see the examples below.
Just use
```PowerShell
$left = [hashtable]@{
"firstname" = "Florian"
"lastname" = "Friedrichs"
"address" = [hashtable]@{
"Street" = "Kaiserstraße 35"
}
"tags" = [Array]@("nice","company")
"product" = [PSCustomObject]@{
"name" = "Orbit"
"owner" = "Apteco Ltd."
}
}
$right = [hashtable]@{
"lastname" = "von Bracht"
"Street" = "Schaumainkai 87"
"address" = [hashtable]@{
"Street" = "Schaumainkai 87"
"Postcode" = 60596
}
"tags" = [Array]@("wow")
"product" = [PSCustomObject]@{
"sprint" = 106
}
}
Merge-Hashtable -Left $left -right $right -AddKeysFromRight -MergeArrays -MergePSCustomObjects -MergeHashtables
```
to merge two nested hashtables into one where the "right" will overwrite existing values from "left".
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2024 Apteco GmbH. All rights reserved.
Package Details
Author(s)
- florian.von.bracht@apteco.de
Tags
Functions
PSEditions
Dependencies
This module has no dependencies.
Release Notes
0.0.4 Bumped the copyright year to 2024
0.0.3 Remove dependency for MergePSCustomObject module and add dynamically a message, when it will be needed
0.0.2 Add dependency for MergePSCustomObject module
0.0.1 Initial release of merge hashtable module through psgallery
FileList
- MergeHashtable.nuspec
- Public\Merge-Hashtable.ps1
- MergeHashtable.psd1
- MergeHashtable.psm1
Version History
Version | Downloads | Last updated |
---|---|---|
0.0.4 (current version) | 32 | 6/24/2024 |
0.0.3 | 80 | 8/18/2023 |
0.0.2 | 8 | 8/18/2023 |
0.0.1 | 9 | 8/18/2023 |