code: function setOptions(command, query) {
    var count, opts;
  
    command = commands[command];
    if (!command) {
      return;
    }
  
    opts = {};
    count = Object.keys(query).length;
  
    [options.common].concat(command.options).some(function someTypes(options) {
      if (!options) {
        return;
      }
      Object.keys(options).some(function someOptions(key) {
        var valid = options[key].valid;
  
        if (key in query) {
          if (options[key].bool) {
            opts[options[key].name] = !reBool.test(query[key]);
          } else if (!valid || (valid && valid.test(query[key]))) {
            opts[options[key].name] = decodeURIComponent(query[key]);
          }
          count -= 1;
        }
  
        return count === 0;
      });
  
      return count === 0;
    });
  
    return opts;
  }
docs: set valid options only per command