/* eslint-disable no-underscore-dangle */
const getClosestVueParent = ($parent, cssClass) => {
  if (!$parent || !$parent.$el) {
    return false;
  }

  if ($parent._uid === 0) {
    return false;
  }

  if ($parent.$el.classList.contains(cssClass)) {
    return $parent;
  }

  return getClosestVueParent($parent.$parent, cssClass);
};

export default getClosestVueParent;
