Skip to content

Commit

Permalink
Rename "totcl" "_totcl"
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed Sep 5, 2016
1 parent 19f2e61 commit a1c93d9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/builtin.jq
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,16 @@ def walk(f):
end;

# Convert the input to a string representation of Tcl dictionaries.
def totcl:
def _totcl:
if type == "array" then
# Convert array to object with keys 0, 1, 2... and process
# it as object.
[range(0;length) as $i
| {key: $i | tostring, value: .[$i]}]
[range(0;length) as $i | {key: $i | tostring, value: .[$i]}]
| from_entries
| totcl
| _totcl
elif type == "object" then
to_entries
| [.[] | "{" + .key + "} {" + (.value | totcl) + "}"]
| [.[] | "{" + .key + "} {" + (.value | _totcl) + "}"]
| join(" ")
else
tostring
Expand All @@ -309,7 +308,7 @@ def totcl:

def format(fmt):
if fmt == "tcl" then
totcl
_totcl
else
_format(fmt)
end;

0 comments on commit a1c93d9

Please sign in to comment.