So I have an Object that contains multiple Objects
const edges = {
edge1: {source: "Horse", target: "4_2_0_0_0f"},
edge2: {source: "Horse", target: "4_2_0_0_0x"},
edge3: {source: "Horse", target: "4_2_0_2_1h"},
edge4: {source: "Horse", target: "4_2_4_0_4z"},
edge5: {source: "Horse", target: "4_2_1_0_0p"},
....}
Now I want to check whether edge2: {source: "Horse", target: "4_2_0_0_0x"} exists in edges or not.
What is the fastest way to do that?
Array.some()method with a callback function that checks for the properties you want.edge2property? Then it's even easier.if (edges.edge2.source == 'Horse' && edges.edge2.target == '4_2_0_0_0x')