Kaustubh Karkare (2016-01-29T23:07:30.000Z)
I have recently come to feel the need for Object.map, which is like
Array.map,
except that it receive keys instead of indices.

Object.prototype.map = function(mapFn, context) {
  return Object.keys(this)
    .reduce(function(result, key) {
      result[key] = mapFn.call(context, this[key], key, this);
      return result;
    }, {});
};

Without this, I frequently do the exact same thing as the above manually,
which leads to unnecessary code duplication.

Given that, it might make sense to match other methods from Array.prototype

Object.map
Object.filter
Object.every
Object.some
Object.reduce
Object.find
Object.findKey // like Array.findIndex

Note that wherever applicable, the ordering is non-deterministic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160129/34f4dd87/attachment.html>
kaustubh.karkare at gmail.com (2016-01-30T00:04:33.948Z)
I have recently come to feel the need for `Object.map`, which is like
`Array.map`,
except that it receive keys instead of indices.

```
Object.prototype.map = function(mapFn, context) {
  return Object.keys(this)
    .reduce(function(result, key) {
      result[key] = mapFn.call(context, this[key], key, this);
      return result;
    }, {});
};
```

Without this, I frequently do the exact same thing as the above manually,
which leads to unnecessary code duplication.

Given that, it might make sense to match other methods from `Array.prototype`

```
Object.map
Object.filter
Object.every
Object.some
Object.reduce
Object.find
Object.findKey // like Array.findIndex
```

Note that wherever applicable, the ordering is non-deterministic.
kaustubh.karkare at gmail.com (2016-01-29T23:45:49.521Z)
I have recently come to feel the need for Object.map, which is like
Array.map,
except that it receive keys instead of indices.

```
Object.prototype.map = function(mapFn, context) {
  return Object.keys(this)
    .reduce(function(result, key) {
      result[key] = mapFn.call(context, this[key], key, this);
      return result;
    }, {});
};
```

Without this, I frequently do the exact same thing as the above manually,
which leads to unnecessary code duplication.

Given that, it might make sense to match other methods from Array.prototype

```
Object.map
Object.filter
Object.every
Object.some
Object.reduce
Object.find
Object.findKey // like Array.findIndex
```

Note that wherever applicable, the ordering is non-deterministic.