I am trying to find the Javascript values of an object wrapped in another object based on the Object Key using the ES6 way or single-line approach without using the loop.
I have the data object something like this:
data = {
"1":{
"id":1,
"name":"Identifiers",
"data":{
"ID":1,
"nodeId":1,
"eventType":"Identifiers"
},
"2":{
"id":2,
"name":"Events",
"data":{
"ID":2,
"nodeId":1,
"eventType":"ObjectEvent"
}
}
}
}
and I have a connector something like this:
{
"ID":1,
"name":"connector1",
"source":"1",
"target":"2"
}
I want to find the information from data based on the connector.source
I want to pass the connector.source and get the corresponding values from it, something like this:
"id":1,
"name":"Identifiers",
"data":{
"ID":1,
"nodeId":1,
"eventType":"Identifiers"
}
I am aware that I can use the for loop and do that but I am trying to find a ES6 way or using the single line code.