export default function getFormData(element) {
   let data = {};
   if (
      element.name !== undefined &&
      element.name !== null &&
      element.name !== ""
   ) {
      if (typeof element.name === "string") {
         if (element.type === "checkbox") data[element.name] = element.checked;
         else data[element.name] = element.value;
      }
   }
   element.childNodes.forEach((child) => {
      let res = getFormData(child);
      data = Object.assign(data, res);
   });
   return data;
}
