pakmanaged.js
function parseOptions(str, map) {
      if (!map)
        error('parseOptions() internal error: no map given');
    
      // All options are false by default
      var options = {};
      for (var letter in map)
        options[map[letter]] = false;
    
      if (!str)
        return options; // defaults
    
      if (typeof str !== 'string')
        error('parseOptions() internal error: wrong str');
    
      // e.g. match[1] = 'Rf' for str = '-Rf'
      var match = str.match(/^\-(.+)/);
      if (!match)
        return options;
    
      // e.g. chars = ['R', 'f']
      var chars = match[1].split('');
    
      chars.forEach(function(c) {
        if (c in map)
          options[map[c]] = true;
        else
          error('option not recognized: '+c);
      });
    
      return options;
    }
function parseOptions(str, map) {
      if (!map)
        error('parseOptions() internal error: no map given');
    
      // All options are false by default
      var options = {};
      for (var letter in map)
        options[map[letter]] = false;
    
      if (!str)
        return options; // defaults
    
      if (typeof str !== 'string')
        error('parseOptions() internal error: wrong str');
    
      // e.g. match[1] = 'Rf' for str = '-Rf'
      var match = str.match(/^\-(.+)/);
      if (!match)
        return options;
    
      // e.g. chars = ['R', 'f']
      var chars = match[1].split('');
    
      chars.forEach(function(c) {
        if (c in map)
          options[map[c]] = true;
        else
          error('option not recognized: '+c);
      });
    
      return options;
    }
Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.: parseOptions('-a', {'a':'alice', 'b':'bob'});