Okay, so here's the deal...
var obj = people[0];
obj.oAuthID = null;
delete obj.oAuthID;
This code snippet returns...
{
"uuid": "39b2b45f-1dde-4c9a-8765-1bc76f55848f",
"oAuthID": null,
"date": "2013-10-21T16:48:47.079Z",
"updated": "2013-10-21T16:48:47.079Z",
"id": "52655aefcc81bb9adc000001"
}
However, if I use this function to clone the object...
function duplicate(obj) {
// Handling different types including arrays and objects
// Cloning properties to a new object while ignoring certain ones
}
var newObj = duplicate(people[0]);
newObj.oAuthID = null;
delete newObj.oAuthID;
The result now is...
{
"uuid": "39b2b45f-1dde-4c9a-8765-1bc76f55848f",
"date": "2013-10-21T16:48:47.079Z",
"updated": "2013-10-21T16:48:47.079Z",
"id": "52655aefcc81bb9adc000001"
}
I'm tired of having to clone the object just to hide a property. Why do I have to go through all this? How can I make it simpler and more conventional?