I have an object array that looks just about like this
var o = [
{
module : "mod1",
customUrl : [
{ "state" : "name1",
"options" : ["option1", "option2", "option3"]
},
{ "state" : "name2",
"options" : ["option1", "option2", "option3"]
}
]
},
{
module : "mod2",
customUrl : [
{ "state" : "name1",
"options" : ["option1", "option2", "option3"]
},
{ "state" : "name2",
"options" : ["option1", "option2", "option3"]
}
]
}
]
and in a function I a passed a string. I want to be able to check that string against the "module" keys and see if it matches any of them so like
checkName = function(name) {
//check if "name" matches any "module" in o
}
Is this possible (I am using underscore but normal javascript is fine too).Thanks!