Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clone() methods to Document, Directives, Schema and all Nodes #304

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

eemeli
Copy link
Owner

@eemeli eemeli commented Aug 29, 2021

Fixes #130

This adds a deep-copying clone() method to ~everything.

It should also work pretty much automatically for custom nodes, unless they're doing something really exotic that the Object.create calls don't catch.

I also considered static from() methods and copy constructors as alternatives, but using clone() seemed to fit best with the node content structures, and by extension it's easier to then use the same API shape everywhere.

CC @gbouthenot, @christopherthielen

@eemeli eemeli merged commit bea9eae into master Sep 1, 2021
@eemeli eemeli deleted the cloning branch September 1, 2021 11:35
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.

Cloning a Document
1 participant