function handleArguments(args) {
  let mode = 'document',
    criteria = { version: VERSION30 };
  args.forEach((argument) => {
    if (typeof argument === 'object' && Object.keys(argument).length > 0) {
      criteria = argument.hasOwnProperty('version') && SUPPORTED_VERSIONS.includes(argument.version) ?
        Object.assign(criteria, argument) :
        Object.assign(argument, criteria);
    }
    else if (VALID_MODES.includes(argument)) {
      mode = argument;
    }
  });
  return { mode, criteria };
}
Takes a list of arguments and resolve them acording its content
@param {array} args The arguments that will be resolved
@returns {array} The list of arguments after have been resolved