@@ -50,20 +50,20 @@ function ConvertTo-Cson {
50
50
# define a match evaluator for escaping characters
51
51
$escape_replacer = {
52
52
switch ($_ ) {
53
- {$_.Groups [1 ].Success} {
53
+ { $_.Groups [1 ].Success } {
54
54
# group 1, control characters
55
55
switch ($_.Value [0 ]) {
56
56
<# appearing in order of expected frequency, from most frequent to least frequent #>
57
- ([char ]10 ) {' \n' ; continue } # new line
58
- ([char ]9 ) {' \t' ; continue } # tab
59
- ([char ]13 ) {' \r' ; continue } # caridge return
60
- ([char ]12 ) {' \f' ; continue } # new form
61
- ([char ]8 ) {' \b' ; continue } # bell
62
- default {' \u{0:X4}' -f [int16 ]$_ } # unicode escape all others
57
+ ([char ]10 ) { ' \n' ; continue } # new line
58
+ ([char ]9 ) { ' \t' ; continue } # tab
59
+ ([char ]13 ) { ' \r' ; continue } # caridge return
60
+ ([char ]12 ) { ' \f' ; continue } # new form
61
+ ([char ]8 ) { ' \b' ; continue } # bell
62
+ default { ' \u{0:X4}' -f [int16 ]$_ } # unicode escape all others
63
63
}
64
64
continue
65
65
}
66
- {$_.Groups [2 ].Success} {
66
+ { $_.Groups [2 ].Success } {
67
67
# group 2, items that need `\` escape
68
68
" \$ ( $_.Value ) "
69
69
}
@@ -168,7 +168,7 @@ function ConvertTo-Cson {
168
168
# handle objects by recursing with writeProperty
169
169
# iterate through the items (force to a PSCustomObject for consistency)
170
170
foreach ($property in ([PSCustomObject ]$item ).psobject.Properties) {
171
- writeProperty $property.Name $property.Value $ (if ($level -ge 0 ) {" $indention$Indent " } else {$indention }) ($level + 1 )
171
+ writeProperty $property.Name $property.Value $ (if ($level -ge 0 ) { " $indention$Indent " } else { $indention }) ($level + 1 )
172
172
}
173
173
}
174
174
}
0 commit comments