stedolan/jq — pull request #628 by slapresta (2014-11-25 20:59:18+00:00)
Title: Modify map\1 so that it works on objects

Okay, so this may be a crazy idea, but hear me out:

What if we make it so that, instead of map converting its iterable input to an array, we make it return the kind of iterable it was passed? That way, instead of this:

```
$ jq -n '{"a": 1, "b": 2} | map(. * 2)'
[2, 4]
```

We get this:

```
$ jq -n '{"a": 1, "b": 2} | map(. * 2)'
{"a": 2, "b": 4}
```

This change is achieved simply by changing map's implementation from `[.[] | f]` to `.[] |= f`.

For now, I've only changed exactly that, as to spark the discussion. If there's interest on doing this, I'll contribute the necessary changes to the tests and the documentation.

It is an obvious compatibility break, but we get a cleaner way of applying transformations over the values of objects. Previous to this, the common way to do this was `with_entries(.value |= f)`