Skip to content

Commit

Permalink
feat: add doc for std.parseCsv and std.manifestCsv
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitjangid committed May 25, 2023
1 parent 8ea27ab commit 7df78a0
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions doc/_stdlib_gen/stdlib-content.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,20 @@ local html = import 'html.libsonnet';
},
],
},
{
name: 'parseCsv',
params: ['str'],
availableSince: 'upcoming',
description: |||
Parses a CSV string into JSON.
|||,
examples: [
{
input: "std.parseCsv('id,name\n1,foo\n2,bar')",
output: std.parseCsv('id,name\n1,foo\n2,bar'),
},
],
},
{
name: 'encodeUTF8',
params: ['str'],
Expand Down Expand Up @@ -995,6 +1009,39 @@ local html = import 'html.libsonnet';
|||),
],
},
{
name: 'manifestCsv',
params: ['object', 'headers=null'],
availableSince: 'upcoming',
description: [
html.p({}, |||
Convert the given csv compatible object to a CSV.
|||),
html.pre({}, |||
std.manifestCsv(
{
"id": [1, 2],
"name": ["foo", "bar"],
"x": ["baz"],
},
["id", "name"],
|||),
html.p({}, |||
Yields a string containing this CSV:
|||),
html.pre({}, |||
id,name
1,foo
2,bar
|||),
html.p({}, |||
If <code>object</code> param is not a valid csv compatible object, it would be an error.
|||),
html.p({}, |||
The <code>headers</code> param adds is an optional which would default to all fields in the object.
|||),
],
},
{
name: 'manifestXmlJsonml',
params: ['value'],
Expand Down

0 comments on commit 7df78a0

Please sign in to comment.