CamelConverter - more fixes picked up in testing (#30601)

This commit is contained in:
Jordan Borean 2017-09-20 15:17:26 +10:00 committed by GitHub
parent 92426840d6
commit a940eb1e80
2 changed files with 27 additions and 17 deletions

View file

@ -28,15 +28,15 @@ Function Convert-ListToSnakeCase($list) {
foreach ($value in $list) {
if ($value -is [Hashtable]) {
$new_value = Convert-DictToSnakeCase -dict $value
} elseif ($value -is [Array]) {
} elseif ($value -is [Array] -or $value -is [System.Collections.ArrayList]) {
$new_value = Convert-ListToSnakeCase -list $value
} else {
$new_value = $value
}
$snake_list.Add($new_value) | Out-Null
[void]$snake_list.Add($new_value)
}
return $snake_list
return ,$snake_list
}
# converts a dict/hashtable keys from camelCase to snake_case
@ -51,14 +51,14 @@ Function Convert-DictToSnakeCase($dict) {
$value = $dict_entry.Value
if ($value -is [Hashtable]) {
$snake_dict.$snake_key = Convert-DictToSnakeCase -dict $value
} elseif ($value -is [Array]) {
} elseif ($value -is [Array] -or $value -is [System.Collections.ArrayList]) {
$snake_dict.$snake_key = Convert-ListToSnakeCase -list $value
} else {
$snake_dict.$snake_key = $value
}
}
return $snake_dict
return ,$snake_dict
}
# this line must stay at the bottom to ensure all defined module parts are exported