Replies: 2 comments
-
I wouldn't use There are a lot of other ways to do this, it's made a little harder because you have an array of maps, but for example:
|
Beta Was this translation helpful? Give feedback.
-
@mikefarah, thanks a lot for your reply.
I understand your point. However, this is not what I'm doing in my expression, I think. I'm iterating over an array A, then doing one del on another array B in every iteration. it doesn't do multiple dels in one iteration at all. I suppose it is simply equal to pipe up multiple object/array del ops? And, the current reduce behavior is a bit contradictory with the "map-reduce" common semanteme. The accumulator shall be reset to a whole new value after each iteration. The values between two reduce iteration shall have no ties. WDYT? Thanks for creating yq. 💯 |
Beta Was this translation helpful? Give feedback.
-
I reported this as a bug already, but it's a good chance to be a error usage either. So, I cross-post in the discussion; I would appreciate it if anyone could shed some light on this weird behavior. Thanks!
Describe the bug
When I use
delete
operator in theireduce
block, the del doesn't work as I expected.Version of yq: 4.44.3
Operating system: mac
Installed via: homebrew
Input Yaml
test.yml:
Command
The command you ran:
Actual behavior
Expected behavior
Additional context
The behavior is very weird as the input variable
A
changed; another strange behavior is that: I can't delete all the elements, even deleting the array index 0 every time.Beta Was this translation helpful? Give feedback.
All reactions