mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more
This commit is contained in:
@@ -14,6 +14,17 @@ var flattenOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!seq)::[1, 2, 3]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Flatten splat",
|
||||
skipDoc: true,
|
||||
document: `[1, [2], [[3]]]`,
|
||||
expression: `flatten[]`,
|
||||
expected: []string{
|
||||
"D0, P[0], (!!int)::1\n",
|
||||
"D0, P[0], (!!int)::2\n",
|
||||
"D0, P[0], (!!int)::3\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Flatten with depth of one",
|
||||
document: `[1, [2], [[3]]]`,
|
||||
@@ -22,6 +33,17 @@ var flattenOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!seq)::[1, 2, [3]]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Flatten with depth and splat",
|
||||
skipDoc: true,
|
||||
document: `[1, [2], [[3]]]`,
|
||||
expression: `flatten(1)[]`,
|
||||
expected: []string{
|
||||
"D0, P[0], (!!int)::1\n",
|
||||
"D0, P[0], (!!int)::2\n",
|
||||
"D0, P[0], (!!seq)::[3]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Flatten empty array",
|
||||
document: `[[]]`,
|
||||
|
||||
Reference in New Issue
Block a user