icinga-powershell-framework/lib/core/tools/Test-PSCustomObjectMember.psm1

20 lines
438 B
PowerShell
Raw Normal View History

function Test-PSCustomObjectMember()
{
param (
$PSObject,
$Name
);
if ($null -eq $PSObject) {
return $FALSE;
}
# Lets make sure we also test for hashtables in case our object is a hashtable
# instead of a PSCustomObject
if ($PSObject -Is [hashtable]) {
return ([bool]($PSObject.ContainsKey($Name)));
}
2021-08-06 12:12:27 -04:00
return ([bool]($PSObject.PSObject.Properties.Name -eq $Name));
}