Какое значение нас интересует:
const value = 'myValue';.
Как будем проверять его наличие:
// если речь идёт о каком-то конкретном свойстве
const hasValue = x => x && x.value === value;
// если имя свойства не важно
const hasValue = x => Object.values(x || {}).includes(value);
Чтобы обойти вложенные объекты можно применить рекурсию:
const find = (data, test) =>
test(data)
? data
: data === Object(data)
? Object.values(data).reduce((found, n) =>
found !== null ? found : find(n, test)
, null)
: null;
А можно и не применять:
function find(data, test) {
for (const stack = [ data ]; stack.length;) {
const n = stack.pop();
if (test(n)) {
return n;
} else if (n instanceof Object) {
stack.push(...Object.values(n).reverse());
}
}
return null;
}
Ищем объект:
const obj = find(arrayData, hasValue);.