Skip to content

Commit f51a715

Browse files
docs: document the std.deepJoin function
Fixes #933
1 parent d271bd6 commit f51a715

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

doc/_stdlib_gen/stdlib-content.jsonnet

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,26 @@ local exampleDocMultiline(mid, ex) =
13211321
},
13221322
],
13231323
},
1324+
{
1325+
name: 'deepJoin',
1326+
params: ['arr'],
1327+
availableSince: '0.10.0',
1328+
description: |||
1329+
Concatenate an array containing strings and arrays to form a single string. If <code>arr</code> is
1330+
a string, it is returned unchanged. If it is an array, it is flattened and the string elements are
1331+
concatenated together with no separator.
1332+
|||,
1333+
examples: [
1334+
{
1335+
input: 'std.deepJoin(["one ", ["two ", "three ", ["four "], []], "five ", ["six"]])',
1336+
output: std.deepJoin(["one ", ["two ", "three ", ["four "], []], "five ", ["six"]]),
1337+
},
1338+
{
1339+
input: 'std.deepJoin("hello")',
1340+
output: std.deepJoin("hello")
1341+
},
1342+
],
1343+
},
13241344
{
13251345
name: 'lines',
13261346
params: ['arr'],

doc/ref/stdlib.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,6 +2409,40 @@ <h4 id="join">
24092409
</div>
24102410
</div>
24112411

2412+
<div class="hgroup">
2413+
<div class="hgroup-inline">
2414+
<div class="panel">
2415+
<h4 id="deepJoin">
2416+
std.deepJoin(arr)
2417+
</h4>
2418+
</div>
2419+
<div style="clear: both"></div>
2420+
</div>
2421+
</div>
2422+
<div class="hgroup">
2423+
<div class="hgroup-inline">
2424+
<div class="panel">
2425+
<p>
2426+
<em>
2427+
Available since version 0.10.0.
2428+
</em>
2429+
</p>
2430+
<p>
2431+
Concatenate an array containing strings and arrays to form a single string. If <code>arr</code> is
2432+
a string, it is returned unchanged. If it is an array, it is flattened and the string elements are
2433+
concatenated together with no separator.
2434+
</p>
2435+
<p>
2436+
Example: <code>std.deepJoin(["one ", ["two ", "three ", ["four "], []], "five ", ["six"]])</code> yields <code>"one two three four five six"</code>.
2437+
</p>
2438+
<p>
2439+
Example: <code>std.deepJoin("hello")</code> yields <code>"hello"</code>.
2440+
</p>
2441+
</div>
2442+
<div style="clear: both"></div>
2443+
</div>
2444+
</div>
2445+
24122446
<div class="hgroup">
24132447
<div class="hgroup-inline">
24142448
<div class="panel">

0 commit comments

Comments
 (0)