Created
July 28, 2017 09:31
-
-
Save regiskuckaertz/b8272925b9e2eeea1f9f876bf8c30692 to your computer and use it in GitHub Desktop.
Object.prototype.copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty( | |
Object.prototype, | |
'copy', | |
{ value: function(spec) { | |
return Object.freeze(Object.assign({}, this, spec)); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment