I have a two level JSON object
EX:
var regexDefs = {
"alpha": {
"regex" : /^[A-Z]+$/,
"errMsg" : "Alpha Only" }
}
I want to do something akin to searching an array for a key.
(using jQuery's inArray)
var key = "alpha";
alert($.inArray(key,regexDefs));
if the key is in the array then I want to do
if(regexDefs[key].regex.test){ return true; }
I know there may be something funky I'm missing because this is an object not an Array...
doing
$.inArray(key,regexDefs)
returns undefined
=/
Any thoughts?