I am trying to filter non-array JSON object as the following snippet
const filter = { filterRows: ['one'] };
const templateMapper = {
'one': {
title: 'one',
},
'two': {
title: 'two',
},
'three': {
title: 'three',
},
}
const filterDialogView = filter.filterRows;
const filterTemplateMapper = [templateMapper].filter(row => !filterDialogView.includes(row));
console.log(filterTemplateMapper);
But it's not filtering
I am getting following output
[
{
"one": {
"title": "one"
},
"two": {
"title": "two"
},
"three": {
"title": "three"
}
}
]
Desire output
{
"two": {
"title": "two"
},
"three": {
"title": "three"
}
}
I want to filter row based on filterRows for example if filterRows contain one as above JSON then one should be removed from the templateMapper