code: function formData(form) {
      var length = form.length;
      var data = {};
      var value;
      var el;
      var type;
      var name;
  
      var append = function (data, name, value) {
        if (data[name] === undefined) {
          data[name] = value;
        } else {
          if (typeof data[name] === 'string') {
            data[name] = [data[name]];
          }
          data[name].push(value);
        }
      };
  
      for (var i = 0; i < length; i++) {
        el = form[i];
        value = el.value;
        type = el.type;
        name = el.name;
  
        if (type === 'radio') {
          if (el.checked) {
            append(data, name, value);
          }
        } else if (type === 'checkbox') {
          if (data[name] === undefined) {
            data[name] = [];
          }
          if (el.checked) {
            append(data, name, value);
          }
        } else {
          append(data, name, value);
        }
      }
  
      return data;
    }
docs: get an object representation of a form's state