I have an object called data
like this:
var data = {
operators: {
operator1: {
top: 20,
left: 20,
properties: {
title: 'Operator 1',
inputs: {},
outputs: {
output_1: {
label: 'Output 1',
},
output_2: {
label: 'Output 2',
}
}
}
},
operator2: {
top: 80,
left: 300,
properties: {
title: 'Operator 2',
inputs: {
input_1: {
label: 'Input 1',
},
input_2: {
label: 'Input 2',
},
input_3: {
label: 'Input 3',
},
},
outputs: {}
}
},
},
};
How to get a value from data
by a key.
function myFunction(data, key) {
//Find in data with key, and return value.
}
Result: var result = myFunction(data,'output_1')
= Output 1
(get by Title).