我正在尝试从以下对象中消除属性5MinuteRate
和15MinuteRate
。
var object = { requestsPerSecond:
{ mean: 1710.2180279856818,
count: 10511,
'currentRate': 1941.4893498239829,
'1MinuteRate': 168.08263156623656,
'5MinuteRate': 34.74630977619571,
'15MinuteRate': 11.646507524106095 } };
Lodash的omit()函数似乎不能用于嵌套对象。以下代码无法工作:
console.log(_.omit(object, 'requestsPerSecond.count'));
编辑:
我尝试了这个,但它并不完全正确:
var subObject = _.omit(object.requestsPerSecond, '5MinuteRate', '15MinuteRate');
console.log(_.merge(object, subObject));