pvorb/node-clone — pull request #36 by oroce (2014-10-06 19:24:10+00:00)
Title: Cloning prototypes with getter

We are using `clone` in our logger: https://github.com/purposeindustries/node-logify-logstash-transport/blob/master/index.js#L20

If we are trying to clone a `http.ServerResponse` instance the module will throw an exception, because `headersSent` property has only getter: https://github.com/joyent/node/blob/7c0419730b237dbfa0ec4e6fb33a99ff01825a8f/lib/_http_outgoing.js#L398-L402

The added code does the follow:
1. Save prototype into `proto` variable if it has prototype or we can figure it out
2. If it has prototype it will try to find out the descriptors of the property
3. If the property has descriptors but it doesnt have setter we will move to next property (we can safely ignore setting the property on the child object because `Object.create` already created the getter on child.)