140bytes, completeObjectClone polyfill
{
"name": "completeObjectClone",
"description": "Fully clones an object using Object.create, Object.getPrototypeOf, Object.getOwnPropertyNames, and Object.getOwnPropertyDescriptor.",
"keywords": [
"es5",
"object",
"descriptor",
"prototype",
"clone"
]
}
function(a,b){with(Object)return getOwnPropertyNames(a).map(b=function(c){b[c]=getOwnPropertyDescriptor(a,c)}),create(getPrototypeOf(a),b)}
function(
a, // object to clone
b // placeholder
){
with(Object) // import Object.*
return getOwnPropertyNames(a) // get property names
.map(b=function(c){ // iterate names
b[c]=getOwnPropertyDescriptor(a,c) // get descriptors
}),
create(getPrototypeOf(a),b) // get proto and create clone
}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.