Skip to content

Commit 7df78a0

Browse files
committed
feat: add doc for std.parseCsv and std.manifestCsv
1 parent 8ea27ab commit 7df78a0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

doc/_stdlib_gen/stdlib-content.jsonnet

+47
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,20 @@ local html = import 'html.libsonnet';
681681
},
682682
],
683683
},
684+
{
685+
name: 'parseCsv',
686+
params: ['str'],
687+
availableSince: 'upcoming',
688+
description: |||
689+
Parses a CSV string into JSON.
690+
|||,
691+
examples: [
692+
{
693+
input: "std.parseCsv('id,name\n1,foo\n2,bar')",
694+
output: std.parseCsv('id,name\n1,foo\n2,bar'),
695+
},
696+
],
697+
},
684698
{
685699
name: 'encodeUTF8',
686700
params: ['str'],
@@ -995,6 +1009,39 @@ local html = import 'html.libsonnet';
9951009
|||),
9961010
],
9971011
},
1012+
{
1013+
name: 'manifestCsv',
1014+
params: ['object', 'headers=null'],
1015+
availableSince: 'upcoming',
1016+
description: [
1017+
html.p({}, |||
1018+
Convert the given csv compatible object to a CSV.
1019+
|||),
1020+
html.pre({}, |||
1021+
std.manifestCsv(
1022+
{
1023+
"id": [1, 2],
1024+
"name": ["foo", "bar"],
1025+
"x": ["baz"],
1026+
},
1027+
["id", "name"],
1028+
|||),
1029+
html.p({}, |||
1030+
Yields a string containing this CSV:
1031+
|||),
1032+
html.pre({}, |||
1033+
id,name
1034+
1,foo
1035+
2,bar
1036+
|||),
1037+
html.p({}, |||
1038+
If <code>object</code> param is not a valid csv compatible object, it would be an error.
1039+
|||),
1040+
html.p({}, |||
1041+
The <code>headers</code> param adds is an optional which would default to all fields in the object.
1042+
|||),
1043+
],
1044+
},
9981045
{
9991046
name: 'manifestXmlJsonml',
10001047
params: ['value'],

0 commit comments

Comments
 (0)