export const closest = (el, selector) => {
  let matchesFn = '';
  let elm = el;

  // find vendor prefix
  ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'].some((fn) => {
    if (typeof document.body[fn] === 'function') {
      matchesFn = fn;
      return true;
    }
    return false;
  });

  let parent;

  // traverse parents
  while (elm) {
    parent = el.parentElement;
    if (parent && parent[matchesFn](selector)) {
      return parent;
    }
    elm = parent;
  }

  return null;
};

export const travelObject = (obj, path = []) => {
  let newObj = { ...obj };
  if (path.length > 1 || path[0] !== '') {
    newObj = path.reduce((str, key) => str[key], newObj);
  }
  return newObj;
};

@@ -541,16 +541,90 @@
 ll;%0A%7D;%0A%0A
+export const noEmptyStringInArray = arr =%3E arr.every(elm =%3E elm !== '');%0A%0A
 export c
@@ -692,16 +692,17 @@
 .obj %7D;%0A
+%0A
   if (pa
@@ -719,25 +719,37 @@
 %3E 1 
-%7C%7C path%5B0%5D !== ''
+&& noEmptyStringInArray(path)
 ) %7B%0A

add helper fn