I have object
var o = {
first{
aa: 1,
bb: 2,
cc: 3
},
second: {
aa: 2,
dd: 1,
ee: 10
}
}
I need to return new object with same structure but only one property.
getProperty('second.aa');
getProperty = function(path){
_.each(path.split('.'), function(){
//....
});
// need return {second: {aa: 2}}
}
Maybe there are good solutions with underscore or angularjs? Thanx!