5
有没有办法在嵌套的对象属性上使用_.omit
?对象:深忽略
我希望这种情况发生:
schema = {
firstName: {
type: String
},
secret: {
type: String,
optional: true,
private: true
}
};
schema = _.nestedOmit(schema, 'private');
console.log(schema);
// Should Log
// {
// firstName: {
// type: String
// },
// secret: {
// type: String,
// optional: true
// }
// }
_.nestedOmit
显然并不存在,只是_.omit
不影响嵌套的属性,但它应该是清楚我在寻找。
它也不一定是下划线,但根据我的经验,它往往只是使事情变得更短,更清晰。
事情会嵌套任意或只是一个水平? – thefourtheye
将是任意的。 – zimt28