code: function nameTasks(tasks) { //name tasks that are not already named, validation done elsewhere, ret map
      var namesMap = tasks.reduce(function (map, t) {
        if (t.name) { map[t.name] = t; }
        return map;
      }, {});
      tasks.forEach(function (t, idx) {
        if (!t.name) { //not already named
          var name = fName(t.f);
          if (!name) name = sprintf(DEFAULT_TASK_NAME, idx);
          if (!name || namesMap[name]) {
            name = sprintf('%s_%s', name, idx); //if empty or already used, postfix with _idx
          }
          t.name = name;
          namesMap[name] = t;
        }
      });
      return namesMap;
    }
docs: Name tasks that are not already named. Prenamed task uniquness validation
  will be done in validate.
  
  This modifies the tasks with the new names.
  
  @returns map of names to tasks