@@ -83,6 +83,7 @@ local html = import 'html.libsonnet';
8383 {
8484 name: 'objectValues' ,
8585 params: ['o' ],
86+ availableSince: '0.17.0' ,
8687 description: |||
8788 Returns an array of the values in the given object. Does not include hidden fields.
8889 ||| ,
@@ -104,6 +105,7 @@ local html = import 'html.libsonnet';
104105 {
105106 name: 'objectValuesAll' ,
106107 params: ['o' ],
108+ availableSince: '0.17.0' ,
107109 description: |||
108110 As <code>std.objectValues</code> but also includes hidden fields.
109111 ||| ,
@@ -944,10 +946,17 @@ local html = import 'html.libsonnet';
944946 {
945947 name: 'flatMap' ,
946948 params: ['func' , 'arr' ],
947- description: |||
948- Apply the given function to every element of the array to form a new array then flatten the result.
949- It can be thought of as a generalized map, where each element can get mapped to 0, 1 or more elements.
950- ||| ,
949+ description: html.paragraphs([
950+ |||
951+ Apply the given function to every element of <code>arr</code> to form a new array then flatten the result.
952+ The argument <code>arr</code> must be an array or a string. If <code>arr</code> is an array, function <code>func</code> must return an array.
953+ If <code>arr</code> is a string, function <code>func</code> must return an string.
954+ ||| ,
955+ |||
956+ The <code>std.flatMap</code> function can be thought of as a generalized <code>std.map</code>,
957+ with each element mapped to 0, 1 or more elements.
958+ |||
959+ ]),
951960 examples: [
952961 {
953962 input: 'std.flatMap(function(x) [x, x], [1, 2, 3])' ,
@@ -961,6 +970,10 @@ local html = import 'html.libsonnet';
961970 input: 'std.flatMap(function(x) if x == 2 then [] else [x * 3, x * 2], [1, 2, 3])' ,
962971 output: std.flatMap(function (x) if x == 2 then [] else [x * 3 , x * 2 ], [1 , 2 , 3 ]),
963972 },
973+ {
974+ input: 'std.flatMap(function(x) x+x, "foo")' ,
975+ output: std.flatMap(function (x) x+x, "foo" )
976+ },
964977 ],
965978 },
966979 {
0 commit comments