initial Commit
This commit is contained in:
44
Private/Resolve-ConfigurationDataValue.ps1
Normal file
44
Private/Resolve-ConfigurationDataValue.ps1
Normal file
@@ -0,0 +1,44 @@
|
||||
function Resolve-ConfigurationDataValue {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[AllowNull()]
|
||||
$Value,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
$Context
|
||||
)
|
||||
|
||||
if($null -eq $Value){
|
||||
return $null
|
||||
}
|
||||
|
||||
if($Value -is [System.Collections.Specialized.OrderedDictionary]){
|
||||
$Resolved = [ordered]@{}
|
||||
foreach($Entry in $Value.GetEnumerator()){
|
||||
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
|
||||
}
|
||||
return $Resolved
|
||||
}
|
||||
|
||||
if($Value -is [System.Collections.Hashtable]){
|
||||
$Resolved = @{}
|
||||
foreach($Entry in $Value.GetEnumerator()){
|
||||
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
|
||||
}
|
||||
return $Resolved
|
||||
}
|
||||
|
||||
if($Value -is [System.Array] -and $Value -isnot [string]){
|
||||
$Resolved = @()
|
||||
foreach($Item in $Value){
|
||||
$Resolved += ,(Resolve-ConfigurationDataValue -Value $Item -Context $Context)
|
||||
}
|
||||
return ,$Resolved
|
||||
}
|
||||
|
||||
if($Value -is [string] -and (Test-ConfigurationDataExpression -Value $Value)){
|
||||
return Resolve-ConfigurationDataExpression -Expression $Value -Context $Context
|
||||
}
|
||||
|
||||
return $Value
|
||||
}
|
||||
Reference in New Issue
Block a user