Skip to content

Commit c9f12b3

Browse files
committed
format document
1 parent 24842cb commit c9f12b3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ConvertTo-CSON.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ function ConvertTo-Cson {
5050
# define a match evaluator for escaping characters
5151
$escape_replacer = {
5252
switch ($_) {
53-
{$_.Groups[1].Success} {
53+
{ $_.Groups[1].Success } {
5454
# group 1, control characters
5555
switch ($_.Value[0]) {
5656
<# 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
6363
}
6464
continue
6565
}
66-
{$_.Groups[2].Success} {
66+
{ $_.Groups[2].Success } {
6767
# group 2, items that need `\` escape
6868
"\$($_.Value)"
6969
}
@@ -168,7 +168,7 @@ function ConvertTo-Cson {
168168
# handle objects by recursing with writeProperty
169169
# iterate through the items (force to a PSCustomObject for consistency)
170170
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)
172172
}
173173
}
174174
}

0 commit comments

Comments
 (0)