Private/Helper/Confirm-BDContainsParamType.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Confirm-BDContainsParamType {
    [CmdletBinding()]
    [OutputType([bool])]
    param (
        $Contains
    )

    process {
        $TypeNames = $Contains.psObject.TypeNames
        If ($TypeNames -contains 'System.Collections.Hashtable') {
            Return $true
        } ElseIf ($TypeNames -contains 'System.String') {
            Return $true
        } Else {
            Throw [System.ArgumentException]::new("Contains should be of type string or type hashtable")
        }
    }
}