Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function isCustomObject(obj) {
var result = obj && Object.prototype.toString.call(obj) == '[object Object]';
return result;
}
function deepOmit(obj) {
var newEntity = _.transform(obj, function(result, value, key) {
console.log(value.constructor.name);
var isParentProperty = String(key).toLowerCase().indexOf("parent") >= 0;
if (!isParentProperty) {
if (_.isArray(value) || isCustomObject(value)) {
result[key] = deepOmit(value);
}
else {
result[key] = value;
}
}
});
return newEntity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.