code: function _validateSerializedArray(collection) {
    if (!Array.isArray(collection)) {
      throw new TypeError(collection + ' is not an array.');
    }
  
    if (collection.length === 0) {
      throw new Error(collection + ' is empty.');
    }
  
    if (collection[0].hasOwnProperty('name')) {
      if (typeof collection[0].name !== 'string') {
        throw new TypeError(
          'Invalid value type passed for name of option ' +
            collection[0].name +
            '. Value should be string.'
        );
      }
    } else {
      throw new Error(collection[0] + 'does not contain name key.');
    }
  }
docs: Validate the structure of the array
  It must be formatted like jQuery's serializeArray()
  @param {Array} collection Array of object [{ name: "Size", value: "36" }, { name: "Color", value: "Black" }]