Private/Validate-DefinitionObject.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function Validate-DefinitionObject {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
        [ValidateNotNullOrEmpty()]
        [object]$InputObject
    )
    $InputObject | % {
        if ($_.GetType() -ne [hashtable]) {
            Write-Warning "`n$(($InputObject | Out-String).Trim())"
            throw "Object is not a hashtable."
        }
        $_
    }
}