I get a lot of arrays from API but a count of id different and I need to check for match [id = region...] and to get only this object. How I can do this using regular expressions and find?
(5) [{…}, {…}, {…}, {…}, {…}]
0: {id: "address.7576869587107444", type: "Feature", place_type: Array(1), relevance: 1, properties: {…}, …}
1: {id: "postcode.12959148828066430", type: "Feature", place_type: Array(1), relevance: 1, properties: {…}, …}
2: {id: "place.14392640799224870", type: "Feature", place_type: Array(1), relevance: 1, properties: {…}, …}
3: {id: "region.9375820343691660", type: "Feature", place_type: Array(1), relevance: 1, properties: {…}, …}
4: {id: "country.13200156005766020", type: "Feature", place_type: Array(1), relevance: 1, properties: {…}, …}
length: 5
__proto__: Array(0)
.then(res => {
let region = /region/gi
console.log(res.data.features.find(place => place.id == region.test(place)))
setAdrress(res.data)
})