Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
Get the values from object wrapped in another object based on the key?

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.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda