function hasProperty (obj, propName) {
  return obj != null && typeof obj === 'object' && (propName in obj);
}
Null safe way of checking whether or not an object,
including its prototype, has a given property