Skip to content

Commit 932a14b

Browse files
authored
implementation for tables (#1817)
1 parent 1a22b60 commit 932a14b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cookbook/jq_v_nushell.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,6 @@ export def "flatten record-paths" [
728728
729729
def flatten-record-paths [separator: string, ctx?: string] {
730730
let input = $in
731-
732731
match ($input | describe-primitive) {
733732
"record" => {
734733
$input
@@ -749,7 +748,12 @@ def flatten-record-paths [separator: string, ctx?: string] {
749748
{path: ([$ctx $e.index] | str join $separator), value: $e.item}
750749
}
751750
},
752-
"table" | "block" | "closure" => { error make {msg: "Unexpected type"} },
751+
"table" => {
752+
$input | enumerate | each { |r| $r.item | flatten-record-paths $separator ([$ctx $r.index] | str join $separator) }
753+
}
754+
"block" | "closure" => {
755+
error make {msg: "Unexpected type"}
756+
},
753757
_ => {
754758
{path: $ctx, value: $input}
755759
},

0 commit comments

Comments
 (0)