You can check it against the Object’s keys using Array.some
which returns a bool
.
if(Object.keys(obj).some(function(k){ return ~k.indexOf("addr") })){
// it has addr property
}
You could also use Array.filter
and check it’s length. But Array.some
is more apt here.