Reputation: 35
Based on an object like this:
var p = [
{x: [
{x1: 1},
]
},
{x: [
{x1: 2},
]
}
];
I need to filter p
objects when x1 is different from 1:
var p = [
{x: [
{x1: 2},
]
}
];
Thanks in advance.
Upvotes: 1
Views: 59
Reputation: 21658
var p = [
{x: [
{x1: 1},
]
},
{x: [
{x1: 2},
]
}
];
const results = p.filter(val => !val.x.some(v => v.x1 === 1));
console.log(results);
Upvotes: 3