Use ES7 spread properties to make shallow clones of objects.#44
Conversation
I don't know if you have ES7 object rest/spread properties enabled, but, if you do, here's an easy ES7 idiom for creating a new object with all the same own properties of a given object. Specification: https://github.com/sebmarkbage/ecmascript-rest-spread
There was a problem hiding this comment.
Looks like this was the last use of footnote 3 -- can you delete that footnote? (after confirming it really was the last.)
|
I don't know very much about clone(), but does it do a deep copy or a shallow copy? The spread property only does a shallow copy, right? |
|
Yep - |
|
Perseus uses |
|
OK, great -- once the footnoes are cleaned up I'll merge this! |
I don't know if you have ES7 object rest/spread properties enabled, but, if you do, here's an easy ES7 idiom for creating a new object with all the same own properties of a given object.
Specification: https://github.com/sebmarkbage/ecmascript-rest-spread