I've got an object which looks like this:
var myObject = {
array1: [
{id: "aaa"},
{id: "bbb"},
{id: 'ccc'}
],
array2: [
{id: "ddd"},
{id: "eee"},
{id: 'fff'}
],
childObject: {
property: "value"
}
};
What I need is a function that gets the name of an array with certain id value. For example:
getArrayName("myObject", "id", "eee") //returns "array2"
because it's always "id" it can be simplified to:
getArrayName("myObject", "ccc") //returns "array1"
I'm using lodash in this project, so I've tried .findKey(), but I can't get it to work.