Fold to string

This commit is contained in:
Florian Schroedl
2022-06-10 13:57:21 +02:00
parent a8ed752d7f
commit b0b87869d9

View File

@@ -115,11 +115,11 @@ proc makeOrg*(x: string): OrgBuilderResult =
acc
proc foldOrg*(x: OrgBuilderResult): seq[string] =
proc foldOrg*(x: OrgBuilderResult): string =
x
.fold(
(err) => @["Error"],
(builder: OrgBuilder) => builder.tree.map((x: OrgBlock) => $x.headlineContent),
(err) => "Error",
(builder: OrgBuilder) => $builder.tree,
)
# echo acc.unsafeGet().tree[^1]
@@ -142,5 +142,5 @@ Some stuff inbetween
var acc = makeOrg(test1)
echo acc .foldOrg()
echo acc.foldOrg()
# echo acc.unsafeGet().tree[^1]