Skip to content

Instantly share code, notes, and snippets.

View kewogc's full-sized avatar
🏠
Working from home

Lol kek kewogc

🏠
Working from home
View GitHub Profile
@kewogc
kewogc / deep_omit.js
Last active August 29, 2015 14:26 — forked from shaundon/deep_omit.js
Like underscore's omit function, but works deeply. Works on both objects and arrays. Requires underscore.
var deepOmit = function(input, propertyToRemove) {
var output = input;
if (_.isArray(input)) {
output = [];
_.each(input, function(arrayItem) {
output.push(deepOmit(arrayItem, propertyToRemove));
});
}
else if (_.isObject(input)) {
output = {};