< Summary - Kestrun — Combined Coverage

Information
Class: Private.Yaml.Convert-OrderedHashtableToDictionary
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Yaml/Convert-OrderedHashtableToDictionary.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 31
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 100% (3/3) Total lines: 31 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Yaml/Convert-OrderedHashtableToDictionary.ps1

#LineLine coverage
 1# Portions derived from PowerShell-Yaml (https://github.com/cloudbase/powershell-yaml)
 2# Copyright (c) 2016–2024 Cloudbase Solutions Srl
 3# Licensed under the Apache License, Version 2.0 (Apache-2.0).
 4# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 5# Modifications Copyright (c) 2025 Kestrun Contributors
 6
 7<#
 8.SYNOPSIS
 9    Convert an OrderedHashtable to an OrderedDictionary, converting any nested PSObjects to generic objects.
 10.DESCRIPTION
 11    This function takes an OrderedHashtable as input and converts it to an OrderedDictionary. It ensures that any nested
 12    The order of keys in the OrderedHashtable is preserved in the resulting OrderedDictionary.
 13.PARAMETER Data
 14    The OrderedHashtable to convert.
 15.EXAMPLE
 16    $oht = [ordered]@{ "Key1" = "Value1"; "Key2" = [PSCustomObject]@{ Prop1 = "Val1"; Prop2 = "Val2" } }
 17    $od = Convert-OrderedHashtableToDictionary $oht
 18    $od is now an OrderedDictionary with Key1 and Key2, where Key2's value is a generic object.
 19.NOTES
 20    This function is designed to work with PowerShell 7.0 and above.
 21#>
 22function Convert-OrderedHashtableToDictionary {
 23    param(
 24        [Parameter(Mandatory = $true)]
 25        [System.Collections.Specialized.OrderedDictionary] $Data
 26    )
 227    foreach ($i in $($data.PSBase.Keys)) {
 128        $Data[$i] = Convert-PSObjectToGenericObject $Data[$i]
 29    }
 130    return $Data
 31}