diff --git a/lib/core/tools/Get-IcingaHashtableItem.psm1 b/lib/core/tools/Get-IcingaHashtableItem.psm1 new file mode 100644 index 0000000..96f0eef --- /dev/null +++ b/lib/core/tools/Get-IcingaHashtableItem.psm1 @@ -0,0 +1,18 @@ +function Get-IcingaHashtableItem() +{ + param( + $Hashtable, + $Key, + $NullValue = $null + ); + + if ($null -eq $Hashtable) { + return $NullValue; + } + + if ($Hashtable.ContainsKey($Key) -eq $FALSE) { + return $NullValue; + } + + return $Hashtable[$Key]; +}