0

I want to filter this data: enter image description here

I have 4 users in this example, all of them has key fbid there is stored facebookID if it matches given key user should be deleted from array. So basicaly I dont want user int this array with given facebookid.

Any help would be perfect. I tried deconstruct it like this : enter image description here But dont know how to filter it now

Tried this: Object.entries(userMap).map(([key, value]) => Object.entries(value[1]).filter(value[1]['fbid'] == '315151515'))

2
  • I answered something similar recently, see if it helps stackoverflow.com/questions/61538865/… Commented May 12, 2020 at 13:43
  • 4
    dont post images for data sets... can you post your data in the question Commented May 12, 2020 at 13:47

1 Answer 1

1

I think you want something like this

var arr = [
  [{
    fbid: 111
  }],
  [{
    fbid: 222
  }],
  [{
    fbid: 333
  }]
]

const searchedFbid=222

const result = arr.filter(x => !x.some(({
  fbid
}) => fbid === searchedFbid))

console.log(result)

Sign up to request clarification or add additional context in comments.

5 Comments

Yes, I will try your example at home, will inform if i succeeded.
@Emilis did that help in the end?
Hi did not had time i will inform, this is on my todo.
Works, like charm, where i could learn such decomposition, i read lots of mozila dev docs, but no luck?
How should the code change if seachedFbid would be an array or object of ids?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.