import lodashGet from 'lodash/get';

/**
 * Access an attribute on an object either using an accessor function or
 * a string attribute path.
 */
const get = function get(obj, accessor, fallback) {
  if (typeof accessor === 'function') {
    const value = accessor(obj);
    return typeof value === 'undefined' ? fallback : value;
  }
  return lodashGet(obj, accessor, fallback);
};
export default get;