JSFiddle - React, Tailwind, and code Playground
by nikoshr
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
JavaScript
_.mixin({
nestedOmit: function(obj, iteratee, context) {
var r = _.omit(obj, iteratee, context);
_.each(r, function(val, key) {
if (typeof(val) === "object")
r[key] = _.nestedOmit(val, iteratee, context);
});
return r;
}
});
var schema = {
firstName: {
type: String
},
secret: {
type: String,
optional: true,
private: true
}
};
console.dir(schema);
schema = _.nestedOmit(schema, 'private');
console.dir(schema);