Find if an object tree has a given property
I am passing a set of options as an object:
var options={
sortRules:[
{...}, // rule 1
{...}, // rule 2
// etc.
},
filterRules:[
{...}, // rule 1
{...}, // rule 2
// etc.
},
etc.
};
My issue: if any rule contains an "encodedName" property, I need to
retrieve ASAP a dictionary of codes via a Web service. The dictionary is
not needed if no "encodedName" property gets passed.
What is the most efficient way to check if an "encodedName" property is
present within this object hierarchy? Looping through all the objects and
sub-objects sounds painful, and I was wondering if there is a faster way.
No comments:
Post a Comment