function getSafeProperty(object, prop) {
  // only allow getting safe properties of a plain object
  if (isPlainObject(object) && isSafeProperty(object, prop)) {
    return object[prop];
  }

  if (typeof object[prop] === 'function' && isSafeMethod(object, prop)) {
    throw new Error('Cannot access method "' + prop + '" as a property');
  }

  throw new Error('No access to property "' + prop + '"');
}
Get a property of a plain object
Throws an error in case the object is not a plain object or the
property is not defined on the object itself
@param {Object} object
@param {string} prop
@return {*} Returns the property value when safe