/* !
Chai - pathval utility
Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
@see https://github.com/logicalparadox/filtr
MIT Licensed
 
### .hasProperty(object, name)

This allows checking whether an object has own
or inherited from prototype chain named property.

Basically does the same thing as the `in`
operator but works properly with null/undefined values
and other primitives.

var obj = {
arr: ['a', 'b', 'c']
, str: 'Hello'
}

The following would be the results.

hasProperty(obj, 'str');  // true
hasProperty(obj, 'constructor');  // true
hasProperty(obj, 'bar');  // false

hasProperty(obj.str, 'length'); // true
hasProperty(obj.str, 1);  // true
hasProperty(obj.str, 5);  // false

hasProperty(obj.arr, 'length');  // true
hasProperty(obj.arr, 2);  // true
hasProperty(obj.arr, 3);  // false

@param {Object} object
@param {String|Symbol} name
@returns {Boolean} whether it exists
@namespace Utils
@name hasProperty
@api public
function hasProperty(obj, name) {
  if (typeof obj === 'undefined' || obj === null) {
    return false;
  }

  // The `in` operator does not work with primitives.
  return name in Object(obj);
}