Object.equals() and Object.clone()

Alexander Jones alex at weej.com
Sun Nov 20 15:54:18 UTC 2016


Object has this unfortunate complication of prototypes, i.e.:

```
const objA = {foo: 1, bar: 2};
const objB = Object.create(objA);
equals(objA, objB) === ?
```

And also there is metadata on each property that can vary (one object has a
property which is configurable, and the other has the same property which
is not configurable), and raise similar questions.

Neither of these questions exist on ES's Map type, or Immutable.js's Map
and List types, for example.

IMO we should be looking at ways to make those types more suitable for many
of the use cases of Object.

On 15 November 2016 at 01:25, Kevin Barabash <kevinb at khanacademy.org> wrote:

> It would be nice if deep equality checking and deep cloning of objects was
> included in the standard library.  Has there been any proposals around
> including these in the past?
>
> – Kevin
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161120/1fbcc706/attachment.html>


More information about the es-discuss mailing list