Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save PatrickJS/0a04b44f5ab2d44f677c to your computer and use it in GitHub Desktop.

Select an option

Save PatrickJS/0a04b44f5ab2d44f677c to your computer and use it in GitHub Desktop.
// Copy an Object with property descriptors
var copy = Object.create(Object.getPrototypeOf(node));
Object.getOwnPropertyNames(node).forEach(propName => {
Object.defineProperty(copy, propName, Object.getOwnPropertyDescriptor(node, propName));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment