Hey there! Currently utilizing the lodash library.
I'm looking to check if the phone number in receivedMessagesMock matches any of the phone numbers in contactsMocks.
If receivedMessagesMock.phone matches contactsMocks.phoneNumbers.value, I want to insert contactsMocks.name.formatted at the same position in receivedMessagesMock.
For instance:
if(receivedMessagesMock[0].phone === contactsMocks.phoneNumbers.value) {
receivedMessagesMock[0].name = contactsMocks.name.formatted;
}
Details about the contactsMock and receivedMessagesMock:
var contactsMock = [{'id':'1','rawId':'1','displayName':'Asd','name':{'givenName':'Asd','formatted':'Asd'},'nickname':null,'phoneNumbers':[{'id':'1','pref':false,'value':'000000000','type':'mobile', 'loggedInSystem':true}],'emails':null,'addresses':null,'ims':null,'organizations':null,'birthday':null,'note':null,'photos':null,'categories':null,'urls':null},{'id':'2','rawId':'2','displayName':'Bbb','name':{'givenName':'Bbb','formatted':'Bbb'},'nickname':null,'phoneNumbers':[{'id':'3','pref':false,'value':'565 65 65 65','type':'mobile'}],'emails':null,'addresses':null,'ims':null,'organizations':null,'birthday':null,'note':null,'photos':null,'categories':null,'urls':null},{'id':'3','rawId':'3','displayName':'Ccc','name':{'givenName':'Ccc','formatted':'Ccc'},'nickname':null,'phoneNumbers':[{'id':'5','pref':false,'value':'0000000001','type':'mobile'}],'emails':null,'addresses':null,'ims':null,'organizations':null,'birthday':null,'note':null,'photos':null,'categories':null,'urls':null},{'id':'4','rawId':'4','displayName':'Ddd','name':{'givenName':'Ddd','formatted':'Ddd'},'nickname':null,'phoneNumbers':[{'id':'6','pref':false,'value':'000 00 00 01','type':'mobile'}],'emails':null,'addresses':null,'ims':null,'organizations':null,'birthday':null,'note':null,'photos':null,'categories':null,'urls':null}];
var receivedMessagesMock = [{
'id': 12,
'phone': '000 00 00 01',
'time': '15:44',
'priority': 1,
'response' : false
},{
'id': 15,
'phone': '000 00 00 01',
'time': '15:44',
'priority': 1,
'response' : false
},{
'id': 16,
'phone': '000 00 00 01',
'time': '15:44',
'priority': 2,
'response' : true
}];