I am having trouble assigning a value from my nested array. The loop is moving through correctly and looks to initially make a comparison of the following arrays.
let searchSource = [ 'media', 'arts'];
let subscriberNodes = [
{
name: 'customer',
nodes: [
{source: 'media'},
]
}
]
Unfortunately with the code below I am not filtering through the data.
let violation = subscriberNodes
.filter( v => v.nodes = v.nodes.filter(q => searchSource === q.source) );
The searchName and q.source compare on one phase of the break point in the debugger but as I click again
q.source // 'EDW' to undefined
I am not sure why I am seeing it compare the same values 2 times and why the second time q.source is undefined. It seems like filters are running 2 times.
I tried this with find as well but errored out the same result on the filter
let qualifierViolations = profilerNodes
.find(item => item.nodes)
.filter(value => value.source === smartSearch)
When using .some I found that everything was getting touched but nothing filtered
let qualifierViolations = subscriberNodes
.filter( v => v.nodes.some(q => searchSource !== q.source) );
At this point I do not know what I am missing or how to fix it. Any insight would be greatly appreciated.
let subscriberNodes = [ { name: 'customer', nodes: [ {source: 'media'}, ] } ]