/**
 * Normalize the `padding` prop as top, right, bottom, and left padding
 * specifications.
 *
 * @param {string|Object} padding
 *   The input of the `padding` prop.
 * @returns {Object}
 */
const normalizePadding = function normalizePadding(padding) {
  if (!padding) {
    return {};
  }
  if (typeof padding !== 'object') {
    return {
      t: padding,
      r: padding,
      b: padding,
      l: padding
    };
  }
  const {
    x,
    y,
    t,
    r,
    b,
    l
  } = padding;
  return {
    t: t || y,
    r: r || x,
    b: b || y,
    l: l || x
  };
};
export default normalizePadding;