mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 10:04:43 +08:00
Adding splat[] short hand to collect,eval,map,omit,path,pick
This commit is contained in:
@@ -15,6 +15,15 @@ var mapOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!seq)::[6, 7, 8]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `[1,2]`,
|
||||
expression: `map(. + 1)[]`,
|
||||
expected: []string{
|
||||
"D0, P[0], (!!int)::2\n",
|
||||
"D0, P[1], (!!int)::3\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Map array",
|
||||
document: `[1,2,3]`,
|
||||
@@ -33,6 +42,16 @@ var mapOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!map)::{x: 11, y: 21, z: 31}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "map values splat",
|
||||
skipDoc: true,
|
||||
document: `{a: 1, b: 2}`,
|
||||
expression: `map_values(. + 1)[]`,
|
||||
expected: []string{
|
||||
"D0, P[a], (!!int)::2\n",
|
||||
"D0, P[b], (!!int)::3\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Map object values",
|
||||
document: `{a: 1, b: 2, c: 3}`,
|
||||
|
||||
Reference in New Issue
Block a user