Skip to content

Conversation

benjamn
Copy link

@benjamn benjamn commented Nov 27, 2015

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

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was the last use of footnote 3 -- can you delete that footnote? (after confirming it really was the last.)

@csilvers
Copy link
Member

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?

@jeresig
Copy link
Member

jeresig commented Jan 19, 2016

Yep - _.clone() is equivalent, so this could work. I think most of the cases that I've seen, that we had, were actually _.deepClone(). But there's no harm in adding this, as well. Would be good to delete (and re-org) the footnotes.

@ariabuckles
Copy link
Contributor

Perseus uses _.clone and, more commonly, _.merge pretty extensively, but has very few if any deepClones :). I think this is useful if we have es7 spread enabled.

@csilvers
Copy link
Member

OK, great -- once the footnoes are cleaned up I'll merge this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants