Added pick including all keys example

This commit is contained in:
Mike Farah
2024-09-06 12:32:36 +10:00
parent c76e432de3
commit 42b92aff13
2 changed files with 33 additions and 0 deletions
+9
View File
@@ -14,6 +14,15 @@ var pickOperatorScenarios = []expressionScenario{
"D0, P[], (!!map)::myMap: {hamster: squeak, cat: meow}\n",
},
},
{
description: "Pick keys from map, included all the keys",
subdescription: "We create a map of the picked keys plus all the current keys, and run that through unique",
document: "myMap: {cat: meow, dog: bark, thing: hamster, hamster: squeak}\n",
expression: `.myMap |= pick( (["thing"] + keys) | unique)`,
expected: []string{
"D0, P[], (!!map)::myMap: {thing: hamster, cat: meow, dog: bark, hamster: squeak}\n",
},
},
{
description: "Pick splat",
skipDoc: true,